CN109587068A - Flow switching method, device, equipment and computer readable storage medium - Google Patents
Flow switching method, device, equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN109587068A CN109587068A CN201811468895.6A CN201811468895A CN109587068A CN 109587068 A CN109587068 A CN 109587068A CN 201811468895 A CN201811468895 A CN 201811468895A CN 109587068 A CN109587068 A CN 109587068A
- Authority
- CN
- China
- Prior art keywords
- message
- flow
- service requester
- channel
- service
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
Abstract
The invention discloses a kind of flow switching methods, comprising the following steps: establishes the network connection between service requester and service provider and each message channel respectively;Obtain the assignment of traffic ratio that this service requester calls service;According to the assignment of traffic ratio, the correspondence message channel of request message is sent using preset this service requester of channel selecting algorithms selection;By the message channel of selection, the request message is sent to service provider from service requester.The invention also discloses a kind of flow shifting device, equipment and computer readable storage mediums.The present invention realizes the accurate switching to each message of flow is constituted between different messages channel.
Description
Technical field
The present invention relates to intelligent O&M technical field more particularly to a kind of flow switching method, device, equipment and computers
Readable storage medium storing program for executing.
Background technique
In existing distributed computing technology framework, service requester generallys use the fixed sendaisle of one process, and disposes
Multiple service requesters carry out the approximate distribution flow of control in proportion.For example, service requester needs to dispose 10 processes altogether,
In, 4 processes are fixed to use message channel A, and 6 fixed process selection message using message channel B namely 40% of process are logical
Road A sends message, and 60% process selection message channel B sends message.If desired flow is switched to from message channel A and is disappeared
Channel B is ceased, then only needs to gradually decrease the number of processes using message channel A, until all processes all use channel B then complete
Switch at flow.
From the foregoing, it will be observed that be to realize what flow switched by adjusting using the number of processes of message channel in the prior art,
Although realizing switching of the flow between different messages channel, when carrying out flow switching, needs to modify configuration and lay equal stress on
Switching is just realized after new starting, and handoff procedure has interruption, disappears to each message for constituting flow in difference therefore, it is impossible to realize
Cease smooth, the accurate switching between channel.
Summary of the invention
The main purpose of the present invention is to provide a kind of flow switching method, device, equipment and computer-readable storage mediums
Matter, it is intended to solve the prior art cannot achieve to constitute flow each message it is smooth, smart between different messages channel
Definitely change.
To achieve the above object, the present invention provides a kind of flow switching method, and the flow switching method includes following step
It is rapid:
The network connection between service requester and service provider and each message channel is established respectively;
Obtain the assignment of traffic ratio that this service requester calls service;
According to the assignment of traffic ratio, is sent and requested using preset this service requester of channel selecting algorithms selection
The correspondence message channel of message;
By the message channel of selection, the request message is sent to service provider from service requester.
Optionally, it before the step of described this service requester of acquisition calls the assignment of traffic ratio of service, also wraps
It includes:
From third party's configuration center dynamic acquisition flow of services allocation table and cache to local;
It is described obtain this service requester call service assignment of traffic ratio include:
The flow of services allocation table is searched, to obtain the assignment of traffic ratio that this service requester calls service,
In, the assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.
Optionally, described to search the flow of services allocation table, to obtain the flow that this service requester calls service
Distributing ratio includes:
According to data center where the corresponding subsystem of service requester and the subsystem, the flow of services point is searched
With table, to obtain the assignment of traffic ratio that this service requester calls service.
Optionally, the assignment of traffic ratio for obtaining the calling service of this service requester includes:
According to data center where the corresponding subsystem of service requester and the subsystem, third party's configuration center is searched
Flow of services allocation table, with this service requester of dynamic acquisition call service assignment of traffic ratio, wherein the flow
Distributing ratio is distribution ratio of the service requester flow in each message channel.
Optionally, described according to the assignment of traffic ratio, it is asked using preset this service of channel selecting algorithms selection
The side of asking send request message correspondence message channel include:
Judge in the assignment of traffic ratio with the presence or absence of the distribution ratio equal to 1;
If it exists, then using equal to 1 distribution ratio correspond to message channel as this service requester send ask the visitor in
Seek the correspondence message channel of message;
If it does not exist, then it will be greater than 0 and the distribution ratio less than 1 correspond to message channel and sends as this service requester
The correspondence message channel of request message;
If this service requester sends the correspondence message channel of request message there are multiple, rule are calculated based on default
Then, message channel corresponding to each request message of this service requester transmission is determined.
Optionally, it if this described service requester sends the correspondence message channel of request message there are multiple, is based on
Default computation rule determines that message channel corresponding to each request message of this service requester transmission includes:
If this service requester sends the correspondence message channel of request message there are multiple, add up this service request
The each request message just sent obtains request message sum;
When the request message sum reaches default value, the request message sum is reset to zero, and tire out again
Count each request message of this service requester transmission;
Wherein, when starting accumulative request message every time, using any message channel in selected message channel as originally
Secondary service requester sends the correspondence message channel of request message;
During each accumulative request message, judge request message quantity that current message channel is flowed into it is described
Whether the ratio between default value reaches the corresponding assignment of traffic ratio in current message channel;
If so, the correspondence message channel of request message is sent using another message channel as this service requester, and
The ratio continued between the request message quantity and the default value that the current message channel that redefines of judgement is flowed into is
It is no to reach the corresponding assignment of traffic ratio in current message channel.
Further, to achieve the above object, the present invention also provides a kind of flow shifting device, the flow shifting devices
Include:
Connection establishment module, the network for being established between service requester and service provider and each message channel respectively
Connection;
Ratio obtains module, and the assignment of traffic ratio of service is called for obtaining this service requester;
Channel selecting module, for according to the assignment of traffic ratio, using preset channel selecting algorithms selection this
The correspondence message channel of service requester transmission request message;
The request message is sent to by flow transmission module for the message channel by selection from service requester
Service provider.
Optionally, the ratio obtains module and is also used to:
From third party's configuration center dynamic acquisition flow of services allocation table and cache to local;
The flow of services allocation table is searched, to obtain the assignment of traffic ratio that this service requester calls service,
In, the assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.
Optionally, the ratio obtains module and is also used to:
According to data center where the corresponding subsystem of service requester and the subsystem, the flow of services point is searched
With table, to obtain the assignment of traffic ratio that this service requester calls service.
Optionally, the ratio obtains module and is also used to:
According to data center where the corresponding subsystem of service requester and the subsystem, third party's configuration center is searched
Flow of services allocation table, with this service requester of dynamic acquisition call service assignment of traffic ratio, wherein the flow
Distributing ratio is distribution ratio of the service requester flow in each message channel.
Optionally, the channel selecting module is used for:
Judge in the assignment of traffic ratio with the presence or absence of the distribution ratio equal to 1;
If it exists, then using equal to 1 distribution ratio correspond to message channel as this service requester send ask the visitor in
Seek the correspondence message channel of message;
If it does not exist, then it will be greater than 0 and the distribution ratio less than 1 correspond to message channel and sends as this service requester
The correspondence message channel of request message;
If this service requester sends the correspondence message channel of request message there are multiple, rule are calculated based on default
Then, message channel corresponding to each request message of this service requester transmission is determined.
Optionally, the channel selecting module is also used to:
If this service requester sends the correspondence message channel of request message there are multiple, add up this service request
The each request message just sent obtains request message sum;
When the request message sum reaches default value, the request message sum is reset to zero, and tire out again
Count each request message of this service requester transmission;
Wherein, when starting accumulative request message every time, using any message channel in selected message channel as originally
Secondary service requester sends the correspondence message channel of request message;
During each accumulative request message, judge request message quantity that current message channel is flowed into it is described
Whether the ratio between default value reaches the corresponding assignment of traffic ratio in current message channel;
If so, the correspondence message channel of request message is sent using another message channel as this service requester, and
The ratio continued between the request message quantity and the default value that the current message channel that redefines of judgement is flowed into is
It is no to reach the corresponding assignment of traffic ratio in current message channel.
Further, to achieve the above object, the present invention also provides a kind of flow switching equipment, the flow switching equipments
Including memory, processor and it is stored in the flow changeover program that can be run on the memory and on the processor,
The step of flow changeover program realizes flow switching method as described in any one of the above embodiments when being executed by the processor.
Further, to achieve the above object, the present invention also provides a kind of computer readable storage medium, the computers
It is stored with flow changeover program on readable storage medium storing program for executing, realizes when the flow changeover program is executed by processor as any of the above-described
The step of flow switching method described in item.
By message channel, the network for building service requester, service provider and each message channel respectively connects the present invention
Connect, to set up multiple transmission channels of flow, and then convenient for constitute each message of flow different messages channel it
Between switch over.In addition, obtaining the assignment of traffic ratio that service requester each time calls service, further so as to according to flow
Ratio is distributed, message channel corresponding to each request message of service requester transmission each time is determined, passes through the message
Request message is sent to service provider from service requester by channel, and then is realized to each message in different messages channel
Between flow switching, due to need not modification restart with postponing, entire handoff procedure is smoother, and passes through assignment of traffic ratio
Flow is controlled to switch, rather than process number, so that flow switching is more accurate.
Detailed description of the invention
Fig. 1 is the structural schematic diagram for the device hardware running environment that inventive flow switching equipment example scheme is related to;
Fig. 2 is the flow diagram of one embodiment of inventive flow switching method;
Fig. 3 is the network connection in one embodiment of inventive flow switching method between service requester and service provider
Configuration diagram;
Fig. 4 is the flow diagram of mono- embodiment of step S30 in Fig. 2;
Fig. 5 is the functional block diagram of inventive flow switching device one.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that described herein, specific examples are only used to explain the present invention, is not intended to limit the present invention.
The present invention provides a kind of flow switching equipment.
Referring to Fig.1, Fig. 1 is the structure for the device hardware running environment that inventive flow switching equipment example scheme is related to
Schematic diagram.
Inventive flow switching equipment preferred deployment is in distributed structure/architecture system, for realizing the stream in distributed system
Measure switching control.
As shown in Figure 1, flow switching equipment may include: processor 1001, such as CPU, communication bus 1002, Yong Hujie
Mouth 1003, network interface 1004, memory 1005.Wherein, communication bus 1002 is logical for realizing the connection between these components
Letter.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), and optional user connects
Mouth 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include the wired of standard
Interface, wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, be also possible to stable memory
(non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processor
1001 storage equipment.It should be noted that processor 1001 is mounted in flow switching equipment using embedded chip mode.
It will be understood by those skilled in the art that the hardware configuration of flow switching equipment shown in Fig. 1 does not constitute convection current
The restriction for measuring switching equipment may include perhaps combining certain components or different portions than illustrating more or fewer components
Part arrangement.
As shown in Figure 1, as may include operating system, net in a kind of memory 1005 of computer readable storage medium
Network communication module, Subscriber Interface Module SIM and flow changeover program.Wherein, operating system is to manage and control flow switching equipment
With the program of software resource, network communication module, Subscriber Interface Module SIM, flow changeover program and other programs or software are supported
Operation;Network communication module is for managing and controlling network interface 1004;Subscriber Interface Module SIM is for managing and controlling user
Interface 1003.
In flow switching equipment hardware configuration shown in Fig. 1, network interface 1004 is mainly used for connecting system background, with
System background carries out data communication;User interface 1003 is mainly used for connecting client (user terminal), carries out data with client
Communication;Flow switching equipment calls the flow changeover program stored in memory 1005 by processor 1001, and executes hereafter
The flow switching method.
Based on the device hardware running environment of above-mentioned flow switching equipment, the following of inventive flow switching method is proposed
Embodiment.
Inventive flow switching method is preferably applied to distributed system, and same distributed system is deployed with multiple subsystems
System, subsystem are that can realize inquiry business, son of transferring accounts for realizing the application program of specific business function, such as Query Subsystem
System can realize that transferred account service, loan subsystem can realize loan transaction.In addition, distributed system uses multiple data centers mode
Subsystem is disposed, same subsystem can be deployed in one or more data centers.
Specifically to indicate atom business in a distributed system to service, for example the service of withholing indicates button convenient for managing
Money business, financial service indicate loan transaction etc..Difference service is distinguished by service identifiers (Topic).Execution business
That is, realizing corresponding service, namely the calling being related between subsystem, thus flow can be generated between different sub-systems.
It is the flow diagram of one embodiment of inventive flow switching method referring to Fig. 2, Fig. 2.In the present embodiment, the stream
Measure switching method the following steps are included:
Step S10 establishes the network connection between service requester and service provider and each message channel respectively;
In the present embodiment, the realization of service needs to establish the network connection between service requester and service provider, with
For transmitting flow, interaction between the two is realized.
In the present embodiment, service requester refers to consumer's (called side of service, some corresponding subsystem) of service, service
Provider refers to supplier's (the called side of service, some corresponding subsystem) of service.Service requester is (suitable by request message
In calling message) it is sent to service provider, and then service provider is called to carry out business processing, service provider returning response
(or not returning response).
Explanation based on above-mentioned distributed system is it is found that in a distributed system, different sub-systems may use identical
Service, for example deposit subsystem, subsystem of providing a loan, subsystem of transferring accounts require using the service of withdrawing the money (such as by withdrawal subsystem
Unite and the service of withdrawal be provided), that is, between deposit subsystem and withdrawal subsystem, providing a loan between subsystem and withdrawal subsystem, turning
All there is flow transmission between account subsystem and withdrawal subsystem.To realize flow control, thus needs to transmit flow and carry out
Switching.
The present embodiment realizes the two by multiple messages channel preferably between service requester and service provider
Between network connection, while further realize to flow transmission switch over control.
As shown in Figure 3, it is assumed that there is message channel A, B to can be used for realizing the network between service requester and service provider
Connection establishes one with message channel A, message channel B respectively preferably in service requester self-starting each with service provider
Network connection, thus by message channel A and/or message channel B, to realize the net between service requester and service provider
Network connection.
In the present embodiment, message channel refers to the channel transmitted to request message and response message.Message channel, which refers to, appoints
What can be used to transmit the channel of message, including but not limited to as RocketMQ (message queue), ActiveMQ,
The message queues such as RabbitMQ (namely message-oriented middleware), or can provide the physical network of message transmission, message-oriented middleware
Physical hardware product etc..
In the present embodiment, service requester establish and message channel between connection, in particular to service requester with disappear
Breath channel between establish physical connection so that service request can by between the message channel and service provider in object
Message circulation can be carried out in reason, it is not intended that centainly there is message circulation.And service provider is established between message channel
Physical connection is established between connection, in particular to service provider and message channel, so that service provider can be by this
Message channel physically can receive the calling message of service requester.
Step S20 obtains the assignment of traffic ratio that this service requester calls service;
In the present embodiment, after establishing the network connection between service requester and service provider, service requester
Request message can be sent to service provider, and then service provider can also be to service requester returning response message.For reality
Now flow between the two is transmitted and is controlled, thus needs to carry out flow switching, it is logical that the present embodiment preferably passes through switching flow transmission
Road is to realize that flow switches.
To realize the accurate switching control to flow, the present embodiment is preferably based on assignment of traffic ratio to be switched into flow
Row control.Assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.Namely assignment of traffic ratio is
Percentages, numerical values recited is between [0,1], and same service requester calls the flow of same services, in each message
The sum of distribution ratio on channel is equal to 1 (100%).
The present embodiment is unlimited for the configuration mode of assignment of traffic ratio.For example, in the configuration file of service requester
Static assignment of traffic ratio is configured, is also possible to configure dynamic assignment of traffic ratio by independent third party.
Step S30, according to the assignment of traffic ratio, using preset this service requester of channel selecting algorithms selection
Send the correspondence message channel of request message;
In the present embodiment, due to being equipped with multiple messages channel between service requester and service provider, and flow is accurate
Switch the output channel it needs to be determined that each message, namely needs to carry out message channel selection.
Since message is initiated by service requester, the present embodiment is preferably by service requester as message channel
Selecting party, to determine which message channel request message that each will be sent specifically uses and is transmitted to service and provides
Side.
The present embodiment preferably calls the assignment of traffic ratio of service according to this service requester of acquisition, and use is preset
The correspondence message channel of this service requester of channel selecting algorithms selection transmission request message.The present embodiment is for channel selecting
The specific implementation process of algorithm is unlimited.
The request message is sent to service from service requester and is provided by step S40 by the message channel of selection
Side.
In the present embodiment, after the sendaisle of message has been determined, the request message that can initiate service requester leads to
It crosses selected message channel and sends service provider to, service provider carries out business processing after receiving request message, then again
Response message is pressed into former message channel backtracking to service requester.
It should be further noted that service provider and service requester need to introduce consistent API, to carry out and take
The transmitting and receiving processing of relevant message is called in business.
The present embodiment builds the network of service requester, service provider and each message channel by message channel respectively
Connection, to set up multiple transmission channels of flow, and then convenient for each message to composition flow in different messages channel
Between switch over.In addition, obtaining the assignment of traffic ratio that service requester each time calls service, further so as to according to stream
Amount distribution ratio, determines message channel corresponding to each request message of service requester transmission each time, is disappeared by this
Request message is sent to service provider from service requester by breath channel, and then is realized logical in different messages to each message
Flow switching between road, is restarted, entire handoff procedure is smoother, and passes through distribution ratio of liquid flow due to that need not modify to match to postpone
Value control flow switching, rather than process number, so that flow switching is more accurate.
Further, since the present invention is by message channel, build service requester, service provider respectively with each message
The network connection in channel, to set up multiple transmission channels of flow, and then can be by configuring assignment of traffic ratio to flow
Switching is controlled.
Therefore, in one embodiment, to be further convenient for carrying out centralized control to distribution ratio of liquid flow value, while avoiding adjusting
Service requester or provider are had an impact when assignment of traffic ratio, it is therefore preferable that being matched by independent third party's configuration center
Assignment of traffic ratio is set, and dynamic configuration is preferably carried out as needed by administrative staff to the specific value of distribution ratio of liquid flow value.
In addition, due to the present invention using by the network connection built between service requester and service provider come
Flow is transmitted, thus assignment of traffic ratio can be set from subsystem level granularity or data center's level granularity, and then can be real
Now to the accurate switching control of flow.
For example, switching flow by different sub-systems.For example deposit subsystem, subsystem of providing a loan, subsystem of transferring accounts calling take
Money service, and by message channel A, B transmit flow, then it is settable deposit subsystem assignment of traffic ratio: message channel A's
Distribution ratio is 0.3, the distribution ratio of message channel B is 0.7 (namely 30% flow walks message channel A, and 70% flow
Walk message channel B);The assignment of traffic ratio of loan subsystem: point that the distribution ratio of message channel A is 0.5, message channel B
It is 0.5 with ratio;It transfers accounts the assignment of traffic ratio of subsystem: the distribution that the distribution ratio of message channel A is 0.2, message channel B
Ratio is 0.8.
In another example switching flow by different data center rank, for example, if depositing subsystem in the flow of data center 1
Message channel A is walked, walks message channel B in the flow of data center 2, then settable deposit subsystem is in different data center
Assignment of traffic ratio: the distribution ratio of message channel A is 1 in data center 1, and the distribution ratio of message channel B is 0;In data
The distribution ratio of message channel A is 0 in the heart 2, and the distribution ratio of message channel B is 1.
As shown in the above description, the assignment of traffic ratio of the present embodiment has the advantage that
(1) process is smooth: dynamic adjustment assignment of traffic ratio as needed, and then can realize the smooth of flow handoff procedure
Adjustment, the mutation without leading to flow transmission quantity because of flow switching.
(2) process is accurate, and risk is controllable: in a first aspect, assignment of traffic ratio can be adjusted from small to large, if flow switched
Occur not meeting expected situation in journey, then being unlikely to high-volume influences calling service.Second aspect, can be by different sub-systems
Switch flow, multiple subsystems one by one can be subjected to flow switching, all subsystems is avoided to use same assignment of traffic
Ratio and to influence face too wide.The third aspect can switch flow by data center's rank, for example certain subsystem is in data center 1
Flow walk channel A, walk channel B in the flow of another data center 2.
In addition, distribution ratio of liquid flow necessary to only obtaining current service according to subsystem level and data center's rank
Value, and then can avoid the waste to distributed system bandwidth and computing resource.
(3) in domination set: the administrative staff of leading flow switching can be by modifying the data of configuration center to concentrate adjustment
Assignment of traffic ratio, and the adjustment process does not need service requester or service provider changes any configuration information.
(4) elasticity is strong:, also can base since the assignment of traffic ratio of the present embodiment is configured by third party's configuration center
It is configured in the actual conditions of distributed system, thus this mode had both been suitble to the scene of a small amount of flow system flow switching of small enterprise,
The scene of similarly suitable thousands of a flow system flow switchings.
(5) boundary is sensitive: since the assignment of traffic ratio of the present embodiment is artificially configured by third party's configuration center, because
And it can guarantee that flow all accurately switches to corresponding message channel and transmitted, and may be not present the situation of flow sideslip.For example,
Assignment of traffic ratio is determined according to random algorithm, then is difficult to ensure same flow, the distribution ratio on each message channel
The sum of be equal to 1, while being also difficult to ensure that distribution ratio can be divided exactly by message bar number, than if any 100 message, wherein
33.33% message is transmitted by message channel A, and 66.67% message is transmitted by message channel B, due to 33.33% He
66.67% can not all be divided exactly by 100, and then lead to that there are the situations of flow sideslip.
Further, since assignment of traffic ratio is present in third party's configuration center, it is therefore desirable to from third party's configuration
The heart obtains assignment of traffic ratio.In one embodiment, it is preferably obtained and is flowed from third party's configuration center by following any mode
Amount distribution ratio.
Mode one: elder generation is from third party's configuration center dynamic acquisition flow of services allocation table and caches to local, then passes through
Query service assignment of traffic table, to obtain the assignment of traffic ratio that this service requester calls service.
Mode two: inquiry request directly is initiated to third party's configuration center, by searching for the service of third party's configuration center
Assignment of traffic table calls the assignment of traffic ratio of service with this service requester of dynamic acquisition.
In the present embodiment, since assignment of traffic ratio may be adjusted in third party's configuration center, it is therefore preferable that timing from
Third party's configuration center dynamic acquisition assignment of traffic ratio.It should be noted that in above two mode, timing can be from the
Tripartite's configuration center dynamic acquisition assignment of traffic ratio is also possible to not timing from third party's configuration center dynamic acquisition flow point
With ratio.
In addition, as can be seen from the above embodiments, to realize the accurate control switched to flow, thus can be from subsystem level grain
Degree or data center's level granularity are arranged assignment of traffic ratio.Therefore, the present embodiment can be according to the corresponding son of service requester
Flow of services allocation table is searched by data center where system and the subsystem, calls service to obtain this service requester
Assignment of traffic ratio.
Flow of services allocation table and assignment of traffic ratio are illustrated further below.
Flow of services allocation table is used to store the assignment of traffic ratio for the service that each subsystem needs to call, and each subsystem
System is divided by data center.
Assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.Namely assignment of traffic ratio is
Percentages, numerical values recited is between [0,1], and same service requester calls the flow of same services, in each message
The sum of distribution ratio on channel is equal to 1 (100%).
Table 1
Flow of services allocation table as shown in Table 1 above specifically presses subsystem level and data center's rank configuration flow
Distribute ratio.Wherein, subsystem 1 calls assignment of traffic ratio corresponding to service T1 in data center 1 are as follows: message channel A
Distribution ratio be 0, the distribution ratio of message channel B is 0.8, the distribution ratio of message channel C is 0.2;Subsystem 2 is in data
Assignment of traffic ratio corresponding to service T1 is called in center 1 are as follows: point that the distribution ratio of message channel A is 1, message channel B
It is 0 with ratio, the distribution ratio of message channel C is 0.
It further, is the flow diagram of mono- embodiment of step S30 in Fig. 2 referring to Fig. 4, Fig. 4.Based on the above embodiment
Described in flow of services allocation table and assignment of traffic ratio explanation, the selection course of message channel is illustrated.
In the present embodiment, above-mentioned steps S30 further comprises:
Step S301 judges in the assignment of traffic ratio with the presence or absence of the distribution ratio equal to 1;
Step S302, and if it exists, the distribution ratio equal to 1 is then corresponded into message channel as this service requester and is sent
All request messages correspondence message channel;
In the present embodiment, since assignment of traffic ratio is distribution ratio of the service requester flow in each message channel, because
This, if flow needs to flow through certain message channel, the corresponding distribution ratio of the message channel is naturally larger than 0, similarly, if desired controls
Flow processed is not passed through certain message channel, then only the corresponding distribution ratio of the message channel need to be set as 0.As in above-mentioned table 1
It is shown, since subsystem 1 is 0 in the distribution ratio of message channel A, it is logical that subsystem 1 calls the flow of service T1 to be not passed through
Road A.
As shown in the above description, if desired control flow flows through some or certain multiple message channels, then only need to be by message
The corresponding distribution ratio in channel is set as 1 or is set as being greater than 0 and the numerical value less than 1.Thus can only be from distribution ratio be 1
Or to be selected greater than 0 and in message channel corresponding to the numerical value less than 1.
In the present embodiment, since the sum of the distribution ratio of same flow on each message channel is equal to 1, if flow
Distribute ratio in exist equal to 1 distribution ratio, then flow can be transmitted by only existing a message channel, other message channels due to
Distribution ratio is unable to transport stream amount for 0, thus can uniquely determine the corresponding message channel of distribution ratio is selected work
For the correspondence message channel for all request messages that this service requester is sent.
As shown in above-mentioned table 1, since subsystem 2 is 1 in the distribution ratio of message channel A, and in other message channels
Distribution ratio be 0, therefore, subsystem 2 calls the flow of service T1 only to pass through message channel A and is transmitted.And if on adjusting
Stating subsystem 2 in table 1 calls the flow of service T1 in the distribution ratio of each message channel, then the switching control of flow can be achieved.
Step S303 then will be greater than 0 and the distribution ratio less than 1 correspond to message channel as this service if it does not exist
The correspondence message channel of requesting party's transmission request message;
In the present embodiment, if can only exist greatly there is no the distribution ratio equal to 1 in the distribution ratio of same flow
In 0 and the distribution ratio less than 1 therefore will be greater than 0 and the distribution ratio less than 1 correspond to message channel and asks as this service
The correspondence message channel of the side's of asking transmission request message.
Further, since the sum of the distribution ratio of same flow on each message channel is equal to 1, because all message may be not present
The case where distribution ratio in channel is all 0, meanwhile, if the distribution ratio equal to 1 is not present in the distribution ratio of same flow,
It certainly exists and multiple is greater than 0 and the distribution ratio less than 1.
As shown in above-mentioned table 1, subsystem 1 is the distribution ratio of message channel A is 0, the distribution ratio of message channel B is
0.8, the distribution ratio of message channel C is 0.2.When subsystem 1 calls service T1, the corresponding transmission channel of flow is logical for message
Road B, C, namely there are multiple corresponding message channels.
Step S304, if this service requester sends the correspondence message channel of request message there are multiple, based on pre-
If computation rule, message channel corresponding to each request message of this service requester transmission is determined.
In the present embodiment, for the accurate switching control for realizing flow, when selected is asked for the transmission of this service requester
Ask the correspondence message channel of message there are it is multiple when, be based further on default computation rule, with determine this service requester hair
Message channel corresponding to each request message sent.It is the equal of that there are multiple channels, then any selection one.
The present embodiment can carry out flow switching control for the data center where subsystem or subsystem, while can
The transmission channel of each request message is accurately controlled, and then is realized to each message between different messages channel
Flow accurately switch.
It is further alternative, in one embodiment, when the correspondence message channel that service requester sends request message exists
When multiple, especially by following computation rule, determine this service requester send each request message corresponding to disappear
Cease channel:
(1) flow dicing treatment is carried out to the request message that service requester is sent, to obtain flow proportional assignment
Numerical benchmark.
In the present embodiment, the request message item number that message channel the is transmitted not only assignment of traffic ratio phase with the channel
It closes, but also related to the sum of request message that service requester is sent.Since the request message that service requester is sent is
At random, not timing and generate in real time, thus the sum of request message can not be obtained ahead of time, so can not determine flow by than
The numerical benchmark of example distribution.Therefore, it is necessary to the request messages sent to service requester to carry out flow dicing treatment, by one
The numerical benchmark that the quantity of the request message of flow stripping and slicing is divided in portion as flow.
The present embodiment obtains a flow stripping and slicing especially by following manner: when service requester sends request message,
Each request message that accumulative service requester is sent obtains request message sum;When request message sum reaches preset number
When value, then a flow stripping and slicing is obtained, while current request message sum is reset to zero, and add up this service again and ask
Each request message that the side of asking is sent, to obtain next flow stripping and slicing.
(2) in same flow stripping and slicing, message channel corresponding to each request message in the stripping and slicing of this flow is determined.
2.1, when starting accumulative request message every time, using any message channel in selected message channel as this
The correspondence message channel of service requester transmission request message;
2.2, during each accumulative request message, judge request message quantity that current message channel is flowed into
Whether the ratio between default value reaches the corresponding assignment of traffic ratio in current message channel;
2.3, if so, the correspondence message that another message channel sends request message as this service requester is led to
Road, and continue to judge that the ratio between the current message channel request message quantity flowed into redefined and default value is
It is no to reach the corresponding assignment of traffic ratio in current message channel;Otherwise, continue to send request message to current message channel.
The present embodiment for ease of understanding calls service T1 to be illustrated with subsystem 1 in above-mentioned table 1 below.
Assuming that the request message total quantity in a flow stripping and slicing is 1000, request message sum is msgNum, is used for
Each request message that accumulative service requester is sent.Since the distribution ratio of message channel B, C are both greater than 0 and less than 1, because
This, sends the correspondence message channel of request message when message channel B, C are called service T1 as this subsystem 1.
1, when starting request message that accumulative subsystem 1 is sent, by first request message be sent to message channel B or
Person's message channel C, it is assumed that selection message channel B sends request message;
2, while continuing to send request message to message channel B, the request for judging that current message channel B is flowed into disappears
Whether the ratio (being set as K) between breath quantity and default value (1000) reaches the corresponding distribution ratio of liquid flow of current message channel B
It is worth (0.8);
If 3, reaching the corresponding assignment of traffic ratio of message channel B, namely when msgNum=800, K=0.8 is then needed
Flow switching is carried out, specifically using message channel C as the flow transmission channel after switching;
4, while being switched to message channel C by flow and continuing to send request message, judge current message channel C institute
Whether the ratio between the request message quantity and default value of inflow reaches the corresponding assignment of traffic ratio of current message channel C
(0.2);Wherein, the request message quantity that message channel C is flowed into can be obtained by msgNum-800.And when the numerical value of msgNum reaches
When to 1000 namely K=0.2, since the numerical value of msgNum at this time has reached default value, then needs to enter next flow and cut
The switching of flow transmission channel in block, while msgNum is set to 0 again.
In the present embodiment, when service requester send request message correspondence message channel there are it is multiple when, using stripping and slicing
Mode flow is divided, and in each flow stripping and slicing according to each message channel configuration assignment of traffic ratio determine
The request message number that each message channel is flowed into, to realize that flow of each message between different messages channel is accurate
Switching.
The present invention also provides a kind of flow shifting devices.
It is the functional block diagram of inventive flow switching device one referring to Fig. 5, Fig. 5.In the present embodiment, the flow
Switching device includes:
Connection establishment module 10, the net for being established between service requester and service provider and each message channel respectively
Network connection;
In the present embodiment, the realization of service needs to establish the network connection between service requester and service provider, with
For transmitting flow, interaction between the two is realized.
In the present embodiment, service requester refers to consumer's (called side of service, some corresponding subsystem) of service, service
Provider refers to supplier's (the called side of service, some corresponding subsystem) of service.Service requester is (suitable by request message
In calling message) it is sent to service provider, and then service provider is called to carry out business processing, service provider returning response
(or not returning response).
Explanation based on above-mentioned distributed system is it is found that in a distributed system, different sub-systems may use identical
Service, for example deposit subsystem, subsystem of providing a loan, subsystem of transferring accounts require using the service of withdrawing the money (such as by withdrawal subsystem
Unite and the service of withdrawal be provided), that is, between deposit subsystem and withdrawal subsystem, providing a loan between subsystem and withdrawal subsystem, turning
All there is flow transmission between account subsystem and withdrawal subsystem.To realize flow control, thus needs to transmit flow and carry out
Switching.
The present embodiment realizes the two by multiple messages channel preferably between service requester and service provider
Between network connection, while further realize to flow transmission switch over control.
As shown in Figure 3, it is assumed that there is message channel A, B to can be used for realizing the network between service requester and service provider
Connection establishes one with message channel A, message channel B respectively preferably in service requester self-starting each with service provider
Network connection, thus by message channel A and/or message channel B, to realize the net between service requester and service provider
Network connection.
In the present embodiment, message channel refers to the channel transmitted to request message and response message.Message channel, which refers to, appoints
What can be used to transmit the channel of message, including but not limited to such as RocketMQ, ActiveMQ, RabbitMQ message queue
(namely message-oriented middleware), or can provide physical network, the message-oriented middleware physical hardware product etc. of message transmission.
In the present embodiment, service requester establish and message channel between connection, in particular to service requester with disappear
Breath channel between establish physical connection so that service request can by between the message channel and service provider in object
Message circulation can be carried out in reason, it is not intended that centainly there is message circulation.And service provider is established between message channel
Physical connection is established between connection, in particular to service provider and message channel, so that service provider can be by this
Message channel physically can receive the calling message of service requester.
Ratio obtains module 20, and the assignment of traffic ratio of service is called for obtaining this service requester;
In the present embodiment, after establishing the network connection between service requester and service provider, service requester
Request message can be sent to service provider, and then service provider can also be to service requester returning response message.For reality
Now flow between the two is transmitted and is controlled, thus needs to carry out flow switching, it is logical that the present embodiment preferably passes through switching flow transmission
Road is to realize that flow switches.
To realize the accurate switching control to flow, the present embodiment is preferably based on assignment of traffic ratio to be switched into flow
Row control.Assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.Namely assignment of traffic ratio is
Percentages, numerical values recited is between [0,1], and same service requester calls the flow of same services, in each message
The sum of distribution ratio on channel is equal to 1 (100%).
The present embodiment is unlimited for the configuration mode of assignment of traffic ratio.For example, in the configuration file of service requester
Static assignment of traffic ratio is configured, is also possible to configure dynamic assignment of traffic ratio by independent third party.
Channel selecting module 30 is used for according to the assignment of traffic ratio, using preset channel selecting algorithms selection sheet
Secondary service requester sends the correspondence message channel of request message;
In the present embodiment, due to being equipped with multiple messages channel between service requester and service provider, and flow is accurate
Switch the output channel it needs to be determined that each message, namely needs to carry out message channel selection.
Since message is initiated by service requester, the present embodiment is preferably by service requester as message channel
Selecting party, to determine which message channel request message that each will be sent specifically uses and is transmitted to service and provides
Side.
The present embodiment preferably calls the assignment of traffic ratio of service according to this service requester of acquisition, and use is preset
The correspondence message channel of this service requester of channel selecting algorithms selection transmission request message.The present embodiment is for channel selecting
The specific implementation process of algorithm is unlimited.
Flow transmission module 40 sends the request message from service requester for the message channel by selection
To service provider.
In the present embodiment, after the sendaisle of message has been determined, the request message that can initiate service requester leads to
It crosses selected message channel and sends service provider to, service provider carries out business processing after receiving request message, then again
Response message is pressed into former message channel backtracking to service requester.
It should be further noted that service provider and service requester need to introduce consistent API, to carry out and take
The transmitting and receiving processing of relevant message is called in business.
The present embodiment builds the network of service requester, service provider and each message channel by message channel respectively
Connection, to set up multiple transmission channels of flow, and then convenient for each message to composition flow in different messages channel
Between switch over.In addition, obtaining the assignment of traffic ratio that service requester each time calls service, further so as to according to stream
Amount distribution ratio, determines message channel corresponding to each request message of service requester transmission each time, is disappeared by this
Request message is sent to service provider from service requester by breath channel, and then is realized logical in different messages to each message
Flow switching between road, is restarted, entire handoff procedure is smoother, and passes through distribution ratio of liquid flow due to that need not modify to match to postpone
Value control flow switching, rather than process number, so that flow switching is more accurate.
Further, since inventive flow switching device is by message channel, service requester, service provider are built
Respectively with the network connection of each message channel, to set up multiple transmission channels of flow, and then can be by configuring assignment of traffic
Ratio is to be switched into row control to flow.
Therefore, in one embodiment of inventive flow switching device, to be further convenient for collecting distribution ratio of liquid flow value
Middle control, while avoiding having an impact service requester or provider when adjustment assignment of traffic ratio, it is therefore preferable that by independence
Third party's configuration center configure assignment of traffic ratio, and to the specific value of distribution ratio of liquid flow value preferably by administrative staff according to
It needs to carry out dynamic configuration.
Since assignment of traffic ratio is present in third party's configuration center, it is therefore desirable to obtain flow from third party's configuration center
Distribute ratio.In one embodiment, ratio obtains module 20 and is preferably obtained by following any mode from third party's configuration center
Take assignment of traffic ratio.
Mode one: elder generation is from third party's configuration center dynamic acquisition flow of services allocation table and caches to local, then passes through
Query service assignment of traffic table, to obtain the assignment of traffic ratio that this service requester calls service.
Mode two: inquiry request directly is initiated to third party's configuration center, by searching for the service of third party's configuration center
Assignment of traffic table calls the assignment of traffic ratio of service with this service requester of dynamic acquisition.
In the present embodiment, since assignment of traffic ratio may be adjusted in third party's configuration center, it is therefore preferable that timing from
Third party's configuration center dynamic acquisition assignment of traffic ratio.It should be noted that in above two mode, timing can be from the
Tripartite's configuration center dynamic acquisition assignment of traffic ratio is also possible to not timing from third party's configuration center dynamic acquisition flow point
With ratio.
In addition, due to the present invention using by the network connection built between service requester and service provider come
Flow is transmitted, thus assignment of traffic ratio can be set from subsystem level granularity or data center's level granularity, and then can be real
Now to the accurate switching control of flow.Therefore, in one embodiment, ratio acquisition module 20 can be corresponding according to service requester
Flow of services allocation table is searched by data center where subsystem and the subsystem, calls clothes to obtain this service requester
The assignment of traffic ratio of business.
Flow of services allocation table and assignment of traffic ratio are illustrated further below.
Flow of services allocation table is used to store the assignment of traffic ratio for the service that each subsystem needs to call, and each subsystem
System is divided by data center.
Assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.Namely assignment of traffic ratio is
Percentages, numerical values recited is between [0,1], and same service requester calls the flow of same services, in each message
The sum of distribution ratio on channel is equal to 1 (100%).
Table 2
Flow of services allocation table as shown in Table 2 above specifically presses subsystem level and data center's rank configuration flow
Distribute ratio.Wherein, subsystem 1 calls assignment of traffic ratio corresponding to service T2 in data center 1 are as follows: message channel A
Distribution ratio be 0.3, the distribution ratio of message channel B is 0.5, the distribution ratio of message channel C is 0.2;Subsystem 2 is in number
Assignment of traffic ratio corresponding to T2 is serviced according to calling in center 1 are as follows: the distribution ratio of message channel A is 1, message channel B's
Distribution ratio is 0, the distribution ratio of message channel C is 0.
Further, above-mentioned flow shifting device flow of services allocation table as described in the examples and assignment of traffic are based on
Ratio explanation, is illustrated the selection course of message channel.
In the present embodiment, the channel selecting module 30 is specifically used for:
Judge in the assignment of traffic ratio with the presence or absence of the distribution ratio equal to 1;
If it exists, then using equal to 1 distribution ratio correspond to message channel as this service requester send ask the visitor in
Seek the correspondence message channel of message;
If it does not exist, then it will be greater than 0 and the distribution ratio less than 1 correspond to message channel and sends as this service requester
The correspondence message channel of request message;
If this service requester sends the correspondence message channel of request message there are multiple, rule are calculated based on default
Then, message channel corresponding to each request message of this service requester transmission is determined.
In the present embodiment, since assignment of traffic ratio is distribution ratio of the service requester flow in each message channel, because
This, if flow needs to flow through certain message channel, the corresponding distribution ratio of the message channel is naturally larger than 0, similarly, if desired controls
Flow processed is not passed through certain message channel, then only the corresponding distribution ratio of the message channel need to be set as 0.As in above-mentioned table 2
It is shown, since subsystem 2 is 0 in the distribution ratio of message channel B, C, subsystem 2 calls the flow of service T2 to be not passed through
Channel B, C.
As shown in the above description, if desired control flow flows through some or certain multiple message channels, then only need to be by message
The corresponding distribution ratio in channel is set as 1 or is set as being greater than 0 and the numerical value less than 1.Thus can only be from distribution ratio be 1
Or to be selected greater than 0 and in message channel corresponding to the numerical value less than 1.
In the present embodiment, since the sum of the distribution ratio of same flow on each message channel is equal to 1, if flow
Distribute ratio in exist equal to 1 distribution ratio, then flow can be transmitted by only existing a message channel, other message channels due to
Distribution ratio is unable to transport stream amount for 0, thus can uniquely determine the corresponding message channel of distribution ratio is selected work
For the correspondence message channel for all request messages that this service requester is sent.
As shown in above-mentioned table 2, since subsystem 2 is 1 in the distribution ratio of message channel A, and in other message channels
Distribution ratio be 0, therefore, subsystem 2 calls the flow of service T2 only to pass through message channel A and is transmitted.And if on adjusting
Stating subsystem 2 in table 2 calls the flow of service T2 in the distribution ratio of each message channel, then the switching control of flow can be achieved.
In the present embodiment, if can only exist greatly there is no the distribution ratio equal to 1 in the distribution ratio of same flow
In 0 and the distribution ratio less than 1 therefore will be greater than 0 and the distribution ratio less than 1 correspond to message channel and asks as this service
The correspondence message channel of the side's of asking transmission request message.
Further, since the sum of the distribution ratio of same flow on each message channel is equal to 1, because all message may be not present
The case where distribution ratio in channel is all 0, meanwhile, if the distribution ratio equal to 1 is not present in the distribution ratio of same flow,
It certainly exists and multiple is greater than 0 and the distribution ratio less than 1.
As shown in above-mentioned table 2, subsystem 1 distributes the distribution ratio that ratio is 0.3, message channel B message channel A's
Distribution ratio for 0.5, message channel C is 0.2.When subsystem 1 calls service T2, the corresponding transmission channel of flow is message
Channel A, B, C, namely there are multiple corresponding message channels.
In the present embodiment, for the accurate switching control for realizing flow, when selected is asked for the transmission of this service requester
Ask the correspondence message channel of message there are it is multiple when, be based further on default computation rule, with determine this service requester hair
Message channel corresponding to each request message sent.
The present embodiment can carry out flow switching control for the data center where subsystem or subsystem, while can
The transmission channel of each request message is accurately controlled, and then is realized to each message between different messages channel
Flow accurately switch.
It is further alternative, in another embodiment of inventive flow switching device, disappear when service requester sends request
The correspondence message channel of breath there are it is multiple when, channel selecting module 30 determines that this service is asked especially by following computation rule
Message channel corresponding to each request message that the side of asking is sent:
(1) flow dicing treatment is carried out to the request message that service requester is sent, to obtain flow proportional assignment
Numerical benchmark.
In the present embodiment, the request message item number that message channel the is transmitted not only assignment of traffic ratio phase with the channel
It closes, but also related to the sum of request message that service requester is sent.Since the request message that service requester is sent is
At random, not timing and generate in real time, thus the sum of request message can not be obtained ahead of time, so can not determine flow by than
The numerical benchmark of example distribution.Therefore, it is necessary to the request messages sent to service requester to carry out flow dicing treatment, by one
The numerical benchmark that the quantity of the request message of flow stripping and slicing is divided in portion as flow.
The present embodiment obtains a flow stripping and slicing especially by following manner: when service requester sends request message,
Each request message that accumulative service requester is sent obtains request message sum;When request message sum reaches preset number
When value, then a flow stripping and slicing is obtained, while current request message sum is reset to zero, and add up this service again and ask
Each request message that the side of asking is sent, to obtain next flow stripping and slicing.
(2) in same flow stripping and slicing, message channel corresponding to each request message in the stripping and slicing of this flow is determined.
2.1, when starting accumulative request message every time, using any message channel in selected message channel as this
The correspondence message channel of service requester transmission request message;
2.2, during each accumulative request message, judge request message quantity that current message channel is flowed into
Whether the ratio between default value reaches the corresponding assignment of traffic ratio in current message channel;
2.3, if so, the correspondence message that another message channel sends request message as this service requester is led to
Road, and continue to judge that the ratio between the current message channel request message quantity flowed into redefined and default value is
It is no to reach the corresponding assignment of traffic ratio in current message channel;Otherwise, continue to send request message to current message channel.
The present embodiment for ease of understanding calls service T2 to be illustrated with subsystem 1 in above-mentioned table 2 below.
Assuming that the request message total quantity in a flow stripping and slicing is 1000, request message sum is msgNum, is used for
Each request message that accumulative service requester is sent.Since the distribution ratio of message channel A, B, C are both greater than 0 and less than 1,
Therefore, the correspondence message channel of request message is sent when message channel A, B, C being called service T2 as this subsystem 1.
1, when starting request message that accumulative subsystem 1 is sent, by first request message be sent to message channel A or
Person's message channel B or message channel C, it is assumed that selection message channel B sends request message;
2, while continuing to send request message to message channel B, the request for judging that current message channel B is flowed into disappears
Whether the ratio (being set as K) between breath quantity and default value (1000) reaches the corresponding distribution ratio of liquid flow of current message channel B
It is worth (0.5);
If 3, reaching the corresponding assignment of traffic ratio of message channel B, namely when msgNum=500, K=0.5 is then needed
Carry out flow switching, it is assumed that using message channel C as the flow transmission channel after switching;
4, while being switched to message channel C by flow and continuing to send request message, judge current message channel C institute
Whether the ratio between the request message quantity and default value of inflow reaches the corresponding assignment of traffic ratio of current message channel C
(0.2);Wherein, the request message quantity that message channel C is flowed into can be obtained by msgNum-500.
If 5, reaching the corresponding assignment of traffic ratio of message channel C, namely when msgNum=700, K=0.2 is then needed
Flow switching is carried out, using message channel A as the flow transmission channel after switching;
6, while being switched to message channel A by flow and continuing to send request message, judge current message channel A institute
Whether the ratio between the request message quantity and default value of inflow reaches the corresponding assignment of traffic ratio of current message channel A
(0.3);Wherein, the request message quantity that message channel A is flowed into can be obtained by msgNum-500-200.And work as the number of msgNum
When value reaches 1000 namely K=0.3, since the numerical value of msgNum at this time has reached default value, then need to enter next stream
The switching of the flow transmission channel in stripping and slicing is measured, while msgNum is set to 0 again.
In the present embodiment, when service requester send request message correspondence message channel there are it is multiple when, using stripping and slicing
Mode flow is divided, and in each flow stripping and slicing according to each message channel configuration assignment of traffic ratio determine
The request message number that each message channel is flowed into, to realize that flow of each message between different messages channel is accurate
Switching.
The present invention also provides a kind of computer readable storage mediums.
Flow changeover program is stored on computer readable storage medium of the present invention, the flow changeover program is by processor
The step of flow switching method as described in the examples such as any of the above-described is realized when execution.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art
The part contributed out can be embodied in the form of software products, which is stored in a storage medium
In (such as ROM/RAM), including some instructions are used so that a terminal (can be mobile phone, computer, server or network are set
It is standby etc.) execute method described in each embodiment of the present invention.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited to above-mentioned specific
Embodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the art
Under the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very much
Form, it is all using equivalent structure or equivalent flow shift made by description of the invention and accompanying drawing content, directly or indirectly
Other related technical areas are used in, all of these belong to the protection of the present invention.
Claims (14)
1. a kind of flow switching method, which is characterized in that the flow switching method the following steps are included:
The network connection between service requester and service provider and each message channel is established respectively;
Obtain the assignment of traffic ratio that this service requester calls service;
According to the assignment of traffic ratio, request message is sent using preset this service requester of channel selecting algorithms selection
Correspondence message channel;
By the message channel of selection, the request message is sent to service provider from service requester.
2. flow switching method as described in claim 1, which is characterized in that call and take in described this service requester of acquisition
Before the step of assignment of traffic ratio of business, further includes:
From third party's configuration center dynamic acquisition flow of services allocation table and cache to local;
It is described obtain this service requester call service assignment of traffic ratio include:
The flow of services allocation table is searched, to obtain the assignment of traffic ratio that this service requester calls service, wherein institute
Stating assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.
3. flow switching method as claimed in claim 2, which is characterized in that it is described to search the flow of services allocation table, with
Obtaining the assignment of traffic ratio that this service requester calling services includes:
According to data center where the corresponding subsystem of service requester and the subsystem, the flow of services distribution is searched
Table, to obtain the assignment of traffic ratio that this service requester calls service.
4. flow switching method as described in claim 1, which is characterized in that described this service requester of acquisition calls service
Assignment of traffic ratio include:
According to data center where the corresponding subsystem of service requester and the subsystem, the clothes of third party's configuration center are searched
Business assignment of traffic table, the assignment of traffic ratio of service is called with this service requester of dynamic acquisition, wherein the assignment of traffic
Ratio is distribution ratio of the service requester flow in each message channel.
5. flow switching method as described in claim 3 or 4, which is characterized in that it is described according to the assignment of traffic ratio, it adopts
Include: with the correspondence message channel that preset this service requester of channel selecting algorithms selection sends request message
Judge in the assignment of traffic ratio with the presence or absence of the distribution ratio equal to 1;
If it exists, then the distribution ratio equal to 1 all requests that message channel is sent as this service requester are corresponded to disappear
The correspondence message channel of breath;
If it does not exist, then it will be greater than 0 and the distribution ratio less than 1 correspond to message channel as this service requester and sends request
The correspondence message channel of message;
If this service requester sends the correspondence message channel of request message there are multiple, based on default computation rule, really
Message channel corresponding to each request message that this fixed service requester is sent.
6. flow switching method as claimed in claim 5, which is characterized in that if this described service requester sends request and disappears
The correspondence message channel of breath is there are multiple, then based on default computation rule, each for determining that this service requester is sent is asked
The message channel corresponding to message is asked to include:
If this service requester sends the correspondence message channel of request message there are multiple, add up this service requester hair
The each request message sent obtains request message sum;
When the request message sum reaches default value, the request message sum is reset to zero, and adds up this again
Each request message that secondary service requester is sent;
Wherein, when starting accumulative request message every time, using any message channel in selected message channel as this clothes
Business requesting party sends the correspondence message channel of request message;
During each accumulative request message, judge request message quantity that current message channel is flowed into it is described preset
Whether the ratio between numerical value reaches the corresponding assignment of traffic ratio in current message channel;
If so, sending the correspondence message channel of request message using another message channel as this service requester, and continue
Whether the ratio between request message quantity and the default value that the current message channel that judgement redefines is flowed into reaches
To the corresponding assignment of traffic ratio in current message channel.
7. a kind of flow shifting device, which is characterized in that the flow shifting device includes:
Connection establishment module, the network for being established between service requester and service provider and each message channel respectively connect
It connects;
Ratio obtains module, and the assignment of traffic ratio of service is called for obtaining this service requester;
Channel selecting module, for according to the assignment of traffic ratio, this to be serviced using preset channel selecting algorithms selection
The correspondence message channel of requesting party's transmission request message;
The request message is sent to service from service requester for the message channel by selection by flow transmission module
Provider.
8. flow shifting device as claimed in claim 7, which is characterized in that the ratio obtains module and is also used to:
From third party's configuration center dynamic acquisition flow of services allocation table and cache to local;
The flow of services allocation table is searched, to obtain the assignment of traffic ratio that this service requester calls service, wherein institute
Stating assignment of traffic ratio is distribution ratio of the service requester flow in each message channel.
9. flow shifting device as claimed in claim 8, which is characterized in that the ratio obtains module and is also used to:
According to data center where the corresponding subsystem of service requester and the subsystem, the flow of services distribution is searched
Table, to obtain the assignment of traffic ratio that this service requester calls service.
10. flow shifting device as claimed in claim 7, which is characterized in that the ratio obtains module and is also used to:
According to data center where the corresponding subsystem of service requester and the subsystem, the clothes of third party's configuration center are searched
Business assignment of traffic table, the assignment of traffic ratio of service is called with this service requester of dynamic acquisition, wherein the assignment of traffic
Ratio is distribution ratio of the service requester flow in each message channel.
11. the flow shifting device as described in claim 9 or 10, which is characterized in that the channel selecting module is used for:
Judge in the assignment of traffic ratio with the presence or absence of the distribution ratio equal to 1;
If it exists, then the distribution ratio equal to 1 all requests that message channel is sent as this service requester are corresponded to disappear
The correspondence message channel of breath;
If it does not exist, then it will be greater than 0 and the distribution ratio less than 1 correspond to message channel as this service requester and sends request
The correspondence message channel of message;
If this service requester sends the correspondence message channel of request message there are multiple, based on default computation rule, really
Message channel corresponding to each request message that this fixed service requester is sent.
12. flow shifting device as claimed in claim 11, which is characterized in that the channel selecting module is also used to:
If this service requester sends the correspondence message channel of request message there are multiple, add up this service requester hair
The each request message sent obtains request message sum;
When the request message sum reaches default value, the request message sum is reset to zero, and adds up this again
Each request message that secondary service requester is sent;
Wherein, when starting accumulative request message every time, using any message channel in selected message channel as this clothes
Business requesting party sends the correspondence message channel of request message;
During each accumulative request message, judge request message quantity that current message channel is flowed into it is described preset
Whether the ratio between numerical value reaches the corresponding assignment of traffic ratio in current message channel;
If so, sending the correspondence message channel of request message using another message channel as this service requester, and continue
Whether the ratio between request message quantity and the default value that the current message channel that judgement redefines is flowed into reaches
To the corresponding assignment of traffic ratio in current message channel.
13. a kind of flow switching equipment, which is characterized in that the flow switching equipment includes memory, processor and storage
On the memory and the flow changeover program that can run on the processor, the flow changeover program is by the processing
It realizes when device executes such as the step of flow switching method of any of claims 1-6.
14. a kind of computer readable storage medium, which is characterized in that be stored with flow on the computer readable storage medium and cut
Program is changed, realizes that flow of any of claims 1-6 such as switches when the flow changeover program is executed by processor
The step of method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811468895.6A CN109587068B (en) | 2018-12-03 | 2018-12-03 | Flow switching method, device, equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811468895.6A CN109587068B (en) | 2018-12-03 | 2018-12-03 | Flow switching method, device, equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109587068A true CN109587068A (en) | 2019-04-05 |
CN109587068B CN109587068B (en) | 2022-08-12 |
Family
ID=65926855
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811468895.6A Active CN109587068B (en) | 2018-12-03 | 2018-12-03 | Flow switching method, device, equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109587068B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021254162A1 (en) * | 2020-06-15 | 2021-12-23 | 京东方科技集团股份有限公司 | Data sending method and apparatus, storage medium, and electronic device |
CN114500542A (en) * | 2020-11-12 | 2022-05-13 | 中移信息技术有限公司 | Service flow distribution method, device, equipment and computer storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101247348A (en) * | 2008-03-12 | 2008-08-20 | 华为技术有限公司 | Load sharing method and device |
CN102868628A (en) * | 2011-07-06 | 2013-01-09 | 阿里巴巴集团控股有限公司 | Flow segmentation method, device and system |
CN105490825A (en) * | 2014-09-15 | 2016-04-13 | 阿里巴巴集团控股有限公司 | Business processing method and device |
CN105630590A (en) * | 2014-11-28 | 2016-06-01 | 阿里巴巴集团控股有限公司 | Business information processing method and device |
WO2017000845A1 (en) * | 2015-06-30 | 2017-01-05 | 中兴通讯股份有限公司 | Traffic control method and apparatus |
CN107015972A (en) * | 2016-01-27 | 2017-08-04 | 五八同城信息技术有限公司 | A kind of computer room business migration methods, devices and systems |
CN108667938A (en) * | 2018-05-18 | 2018-10-16 | 阿里巴巴集团控股有限公司 | Switch the method, apparatus and server of flow |
CN108809730A (en) * | 2018-06-25 | 2018-11-13 | 阿里巴巴集团控股有限公司 | A kind of method and apparatus that stream is cut in computer room control |
CN108874413A (en) * | 2017-10-30 | 2018-11-23 | 北京旷视科技有限公司 | Service upgrade method, apparatus, system and storage medium |
-
2018
- 2018-12-03 CN CN201811468895.6A patent/CN109587068B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101247348A (en) * | 2008-03-12 | 2008-08-20 | 华为技术有限公司 | Load sharing method and device |
CN102868628A (en) * | 2011-07-06 | 2013-01-09 | 阿里巴巴集团控股有限公司 | Flow segmentation method, device and system |
CN105490825A (en) * | 2014-09-15 | 2016-04-13 | 阿里巴巴集团控股有限公司 | Business processing method and device |
CN105630590A (en) * | 2014-11-28 | 2016-06-01 | 阿里巴巴集团控股有限公司 | Business information processing method and device |
WO2017000845A1 (en) * | 2015-06-30 | 2017-01-05 | 中兴通讯股份有限公司 | Traffic control method and apparatus |
CN107015972A (en) * | 2016-01-27 | 2017-08-04 | 五八同城信息技术有限公司 | A kind of computer room business migration methods, devices and systems |
CN108874413A (en) * | 2017-10-30 | 2018-11-23 | 北京旷视科技有限公司 | Service upgrade method, apparatus, system and storage medium |
CN108667938A (en) * | 2018-05-18 | 2018-10-16 | 阿里巴巴集团控股有限公司 | Switch the method, apparatus and server of flow |
CN108809730A (en) * | 2018-06-25 | 2018-11-13 | 阿里巴巴集团控股有限公司 | A kind of method and apparatus that stream is cut in computer room control |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021254162A1 (en) * | 2020-06-15 | 2021-12-23 | 京东方科技集团股份有限公司 | Data sending method and apparatus, storage medium, and electronic device |
CN114500542A (en) * | 2020-11-12 | 2022-05-13 | 中移信息技术有限公司 | Service flow distribution method, device, equipment and computer storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109587068B (en) | 2022-08-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Bittencourt et al. | Mobility-aware application scheduling in fog computing | |
CN108600005A (en) | A method of defence micro services avalanche effect | |
MX2015006471A (en) | Method and apparatus for controlling utilization in a horizontally scaled software application. | |
US20200104177A1 (en) | Resource allocation system, management device, method, and program | |
CN105721552B (en) | A kind of method and DNS system for realizing dynamic load leveling based on DNS | |
JP2001084195A (en) | Network managing system with event control means | |
WO2021254331A1 (en) | Resource management method and system, proxy server, and storage medium | |
CN106790092A (en) | Remote procedure call services end control system and method | |
US20140143427A1 (en) | Providing Resources in a Cloud | |
CN108881509A (en) | A kind of DNS query method and device based on HTTPDNS | |
CN109587068A (en) | Flow switching method, device, equipment and computer readable storage medium | |
CN112541724A (en) | Distribution method and device, electronic equipment and storage medium | |
JP2001022714A (en) | Server computer, load decentralization system, telephone exchange system, and load decentralizing method | |
CN110191362B (en) | Data transmission method and device, storage medium and electronic equipment | |
WO2019034091A1 (en) | Distribution method for distributed data computing, device, server and storage medium | |
CN110727511B (en) | Control method for application program, network side device and computer readable storage medium | |
US20220272578A1 (en) | Method, device and system for implementing edge computing | |
CN110071952B (en) | Service call quantity control method and device | |
WO2016173133A1 (en) | Load sharing implementation method, interface machine, service processor and system | |
CN112905338B (en) | Automatic computing resource allocation method and device | |
CN112398957B (en) | Server scheduling method and device, storage medium and electronic equipment | |
CN111901401B (en) | Method and device for balancing SMF load of session management function | |
WO2020166617A1 (en) | Resource-contention arbitration apparatus, resource-contention arbitration method, and program | |
JPH0756868A (en) | Distributed data processing system | |
CN114079976B (en) | Slice resource scheduling method, apparatus, system and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |