CN114363339B - Traffic switching method, device, system, apparatus, medium and program product - Google Patents

Traffic switching method, device, system, apparatus, medium and program product Download PDF

Info

Publication number
CN114363339B
CN114363339B CN202210019082.9A CN202210019082A CN114363339B CN 114363339 B CN114363339 B CN 114363339B CN 202210019082 A CN202210019082 A CN 202210019082A CN 114363339 B CN114363339 B CN 114363339B
Authority
CN
China
Prior art keywords
service
unit
target
mapping
routed
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
Application number
CN202210019082.9A
Other languages
Chinese (zh)
Other versions
CN114363339A (en
Inventor
关海超
夏龙飞
颜高飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210019082.9A priority Critical patent/CN114363339B/en
Publication of CN114363339A publication Critical patent/CN114363339A/en
Application granted granted Critical
Publication of CN114363339B publication Critical patent/CN114363339B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The disclosure provides a flow switching method, which relates to the distributed field or the financial field. The method comprises the following steps: acquiring a service call request to be routed, wherein the service call request comprises a service call identifier to be routed and a target service; under the condition that the to-be-routed call identifier exists in the first mapping rule, if the target service is determined based on the first mapping relation, routing the service call request to a first target unit; and under the condition that the to-be-routed call identifier does not exist in the first mapping rule, determining a second target unit based on a second mapping relation in a second mapping rule, and routing the service call request to the second target unit. The present disclosure also provides a flow switching apparatus, device, storage medium, and program product.

Description

Traffic switching method, device, system, apparatus, medium and program product
Technical Field
The present disclosure relates to the distributed or financial arts, and more particularly, to a flow switching method, apparatus, system, device, medium, and program product.
Background
The distributed system can distribute the tasks processed by the original single machine to a plurality of machines for processing. With a micro-service architecture, multiple machines are involved in the data storage and computation of processing tasks. Typically, the microservice architecture may be a unitized architecture, i.e., a distributed system is divided into multiple independent units, each of which has deployed therein a complete system service and data governed by the unit.
During the operation of the distributed system, a service call request in a certain range can be routed to a certain unit, and if the unit cannot process the request, the service call request in the range can be switched to another unit.
In the process of implementing the disclosed concept, the inventor finds that at least the following problems exist in the related art: at present, the flow switching takes a unit as a routing unit, the dimension of switching is all services under the unit, the flexibility is poor, and the flow switching requirement of finer granularity cannot be met.
Disclosure of Invention
In view of the foregoing, the present disclosure provides a finer granularity, more flexible traffic switching method, apparatus, system, device, medium, and program product.
In one aspect of the embodiments of the present disclosure, there is provided a traffic switching method, including: acquiring a service call request to be routed, wherein the service call request comprises a service call identifier to be routed and a target service; under the condition that the to-be-routed call identifier exists in a first mapping rule, if the target service is determined based on a first mapping relation, routing the service call request to a first target unit, wherein the target service is deployed in the first target unit, and the first mapping rule comprises the to-be-routed call identifier, the target service and the first mapping relation among the first target unit; and under the condition that the to-be-routed call identifier does not exist in the first mapping rule, determining a second target unit based on a second mapping relation in a second mapping rule, and routing the service call request to the second target unit, wherein the target service is deployed in the second target unit, and the second mapping rule comprises the second mapping relation between the to-be-routed call identifier and the second target unit.
According to the embodiment of the disclosure, if the target service is not determined based on the first mapping relationship, the service call request is routed to the second target unit under the condition that the to-be-routed call identifier exists in the first mapping rule.
According to an embodiment of the present disclosure, the call identifier includes the call identifier to be routed, and before the second target unit is determined based on the second mapping relationship in the second mapping rule, the call identifier further includes setting the second mapping rule, and specifically includes: obtaining N first units, wherein the N first units comprise the second target units, M services are deployed in each first unit, and N, M is an integer greater than or equal to 1; and setting a third mapping relation between each first unit and at least one calling identifier based on a first routing rule, wherein the first routing rule comprises a setting rule taking a unit as a routing unit, and the third mapping relation comprises the second mapping relation.
According to an embodiment of the present disclosure, setting the first mapping rule further includes: and setting a fourth mapping relation between any one of the calling identifiers and any one of the first units and at least one service in the first unit based on a second routing rule, wherein the second routing rule comprises a setting rule taking the service as a routing unit.
According to an embodiment of the present disclosure, in a case where the to-be-routed call identifier does not exist in the first mapping rule, the method further includes: and setting the first mapping relation between the calling identifier to be routed and the first target unit and the target service based on the second routing rule.
According to an embodiment of the present disclosure, the first mapping relationship includes a call identifier list and a service list, the call identifier list includes a call identifier to be routed, the service list includes the target service, and in a case that the call identifier to be routed exists in the first mapping rule, the method further includes: modifying at least one of the call identifier list, the first target unit and the service list in the first mapping relation; and/or modifying the second target unit in the second mapping relation to a third target unit.
Another aspect of an embodiment of the present disclosure provides a flow switching device, including: the system comprises a request acquisition module, a service call module and a service request module, wherein the request acquisition module is used for acquiring a service call request to be routed, and the service call request comprises a call identifier to be routed and a target service; the first routing module is configured to route the service call request to a first target unit if the target service is determined based on a first mapping relationship under the condition that the to-be-routed call identifier exists in a first mapping rule, where the first target unit is deployed with the target service, and the first mapping rule includes the to-be-routed call identifier, the target service, and the first mapping relationship between the first target unit; and the second routing module is used for determining a second target unit based on a second mapping relation in a second mapping rule under the condition that the to-be-routed calling identifier does not exist in the first mapping rule, and routing the service calling request to the second target unit, wherein the target service is deployed in the second target unit, and the second mapping rule comprises the second mapping relation between the to-be-routed calling identifier and the second target unit.
Another aspect of an embodiment of the present disclosure provides a flow switching system, including: the configuration center is used for configuring a first mapping rule and a second mapping rule, wherein the first mapping rule comprises a to-be-routed calling identifier, a target service and a first mapping relation between a first target unit, and the second mapping rule comprises a second mapping relation between the to-be-routed calling identifier and a second target unit; the flow regulator is used for acquiring the first mapping rule and the second mapping rule from the configuration center according to a service call request to be routed from outside the unit, and executing the flow switching method according to the above; and N first units, wherein each first unit is used for calling the target service in response to the service calling request, each N first units comprises a second target unit and a first target unit, and N is an integer greater than or equal to 1.
According to an embodiment of the present disclosure, each of the first units is further configured to: the traffic switching method according to the above is performed according to the service invocation request to be routed generated in the unit.
According to an embodiment of the present disclosure, further comprising: and a route calculation module, configured to be disposed in the traffic conditioner and each of the first units, so as to perform the traffic switching method according to the above.
Another aspect of an embodiment of the present disclosure provides an electronic device, including: one or more processors; and a storage means for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method as described above.
Another aspect of the disclosed embodiments also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method as described above.
Another aspect of the disclosed embodiments also provides a computer program product comprising a computer program which, when executed by a processor, implements a method as described above.
One or more of the above embodiments have the following advantages: after obtaining a service call request to be routed, first, it is determined whether a call identifier to be routed exists in the first mapping rule. And secondly, if the to-be-routed call identifier exists, determining whether the target service exists according to the first mapping relation. And if the target service exists, routing the service call request to a first target unit in the first mapping relation. In addition, if the first mapping rule does not have the to-be-routed call identifier or the target service of the service call request, determining that the second target unit performs routing according to the second mapping relation in the second mapping rule. By setting the second mapping rule and the first mapping rule, the flow switching requirement of the unit dimension or the service dimension can be better met, the switching granularity is finer, and the flexibility is higher.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be more apparent from the following description of embodiments of the disclosure with reference to the accompanying drawings, in which:
fig. 1 schematically illustrates an application scenario diagram of a traffic switching method according to an embodiment of the present disclosure;
fig. 2 schematically illustrates an architecture diagram of a flow switching system according to an embodiment of the present disclosure;
fig. 3 schematically illustrates a flow chart of a flow switching method according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart of setting a second mapping rule according to an embodiment of the disclosure;
FIG. 5 schematically illustrates a flow diagram for traffic switching in the unit dimension, in accordance with an embodiment of the present disclosure;
fig. 6 schematically illustrates a block diagram of a flow switching device according to an embodiment of the present disclosure;
fig. 7 schematically illustrates a block diagram of an electronic device adapted to implement a flow switching method according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In a unitized architecture, to route traffic to the correct target unit, a traffic routing table, such as a unit dimension table, may be designed that includes a second mapping rule. Assuming that there is an application deployed by a unitized architecture, the application can divide the range of the value range of the data according to the attribute value into different sections according to the data range distribution, so that different units process the data of different sections. For example, the last two bits of UserId (i.e., user ID, whose type is an integer value) may be used as a division basis, and the entire service cluster is divided into 5 units, the unit dimension table is shown in table 1 (for example only).
TABLE 1
Last two digits of userId Target unit
00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19 Zone1
20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 Zone2
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 Zone3
60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79 Zone4
80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99 Zone5
Referring to Table 1, traffic with the last 2 bits of userId of 00-19 is routed to Zonel, traffic with the last 2 bits of userId of 20-39 is routed to Zone2, and so on.
Taking Zone1 as an example, if it is abnormal or in consideration of load balancing, the processing performance is poor. Traffic originally routed to Zone may be routed to other units at this point, as shown in table 2, and may be routed to Zone4.
TABLE 2
Last two digits of userId Target unit
00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19 Zone4
20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 Zone2
40,41,42,43,44,45,46,47,48,49,50,51,52,535455,56,57,58,59 Zone3
60,61,6263,64,65,66,67,68,69,70,71,72,73,747576,77,7879 Zone4
80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99 Zone5
Referring to table 2, the last 2 bits of userid are traffic of 00-19 and 60-79, which will be routed to Zone4, zone1 will no longer accept traffic. At present, the flow switching takes a unit as a routing unit, the switching dimension is all services under a Zonel unit, the flexibility is poor, and the flow switching requirement of finer granularity cannot be met.
The embodiment of the disclosure provides a flow switching method, which comprises the following steps: and obtaining a service call request to be routed, wherein the service call request comprises a call identifier to be routed and a target service. And determining a second target unit based on a second mapping relation in a second mapping rule, wherein the second mapping rule comprises a second mapping relation between the to-be-routed call identifier and the second target unit. And under the condition that the call identifier to be routed does not exist in the first mapping rule, routing the service call request to a second target unit, wherein the second target unit is provided with the target service. Under the condition that the to-be-routed call identifier exists in the first mapping rule, if the target service is determined based on the first mapping relation, routing the service call request to the first target unit, wherein the target service is deployed in the first target unit, and the first mapping rule comprises the to-be-routed call identifier, the target service and the first mapping relation between the first target unit.
Compared with the mode of directly determining the second target unit through the to-be-routed call identifier according to the second mapping rule in the unit dimension table, in the embodiment of the disclosure, the first mapping rule and the second mapping rule can be combined, under the condition of performing service dimension flow switching, whether the target service performs flow switching is determined according to the to-be-routed call identifier, and after the target service is determined, the first target unit is determined so as to realize service granularity switching.
According to an embodiment of the present disclosure, after obtaining a service call request to be routed, first, it is determined whether there is a call identifier to be routed in a first mapping rule. And secondly, if the to-be-routed call identifier exists, determining whether the target service exists according to the first mapping relation. And if the target service exists, routing the service call request to a first target unit in the first mapping relation. In addition, if the first mapping rule does not have the to-be-routed call identifier or the target service of the service call request, determining that the second target unit performs routing according to the second mapping relation in the second mapping rule. By setting the second mapping rule and the first mapping rule, the flow switching requirement of the unit dimension or the service dimension can be better met, the switching granularity is finer, and the flexibility is higher.
It should be noted that, the flow switching method, apparatus, system, device, medium and program product provided in the embodiments of the present disclosure may be used in a distributed field, and may also be used in various fields other than the distributed technology, such as a financial field. The application fields of the flow switching method, the flow switching device, the flow switching system, the flow switching equipment, the flow switching medium and the flow switching program product provided by the embodiment of the disclosure are not limited.
Fig. 1 schematically illustrates an application scenario diagram of a traffic switching method according to an embodiment of the present disclosure.
As shown in fig. 1, the application scenario 100 according to this embodiment may include a distributed system, networks 141, 142, and terminal devices 151, 152, 153. Wherein the distributed system includes a load balancing device 160, and a unit 110, B unit 120, and C unit 130.A unit 110 may include servers 111, 112 … … 11N, B unit 120 may include servers 121, 122 … … 12N, C unit 130 may include servers 131, 132 … … 13N. Network 141 is used to provide the medium of communication links between terminal devices 151, 152, 153 and load balancing device 160, and network 142 is used to provide the medium of communication links between load balancing device 160, a unit 110, B unit 120 and C unit 130. The networks 141, 142 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the distributed system via network 141 using terminal devices 151, 152, 153 to receive or send messages, etc. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 151, 152, 153.
The terminal devices 151, 152, 153 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, etc.
Any one of the servers of the load balancing device 160, the a unit 110, the B unit 120, and the C unit 130 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by the user using the terminal devices 151, 152, 153. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be understood that the number of terminal devices, networks, units and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 schematically illustrates an architecture diagram of a flow switching system according to an embodiment of the present disclosure.
As shown in fig. 2, the flow switching system 200 of this embodiment may include a configuration center 210, a flow regulator 220, and N first units 231, 232, … … N (i.e., unit 1, unit 2 … … unit N), where unit 1 may be implemented by the a unit 110 in fig. 1, and other units are also similar to unit 1, corresponding to the hardware units in fig. 1. The solid line in fig. 2 is used to characterize the sending of the service invocation request and the dashed line is used to characterize the obtaining of the second mapping rule and/or the first mapping rule from the configuration center.
The configuration center 210 is configured to configure a second mapping rule and a first mapping rule, where the first mapping rule includes a to-be-routed call identifier, a first mapping relationship between a target service and a first target unit, and the second mapping rule includes a second mapping relationship between the to-be-routed call identifier and a second target unit. The traffic dispatcher 220 is configured to obtain the first mapping rule and the second mapping rule from the configuration center according to a service call request to be routed from outside the unit, and execute the traffic switching method according to the embodiment of the present disclosure. Each first unit is used for calling the target service in response to the service calling request, and the N first units comprise a second target unit and first target units. Each first unit is further configured to execute the traffic switching method according to the embodiment of the present disclosure according to the service call request to be routed generated in the unit. The route calculation module is configured to be disposed in the traffic conditioner and each first unit, so as to execute the traffic switching method according to the embodiment of the disclosure.
Referring to fig. 1 and 2, outside of the unit may refer to outside of the distributed system. The service invocation request to be routed outside the unit may be a service invocation request sent by the user to the distributed system using the terminal device 151, 152, 153. The service call request to be routed generated in the unit may be a service call request generated in each first unit, for example, in the process of executing the service call request sent by the user, call execution of a plurality of services is involved, and after the unit 1 receives the service call request outside the unit, the service call request in the unit may be processed and generated. Referring to fig. 2, when the unit 1 performs the request routing, if the target unit is the unit 1, the request is regarded as an intra-unit call request. If the target unit is not unit 1, then the request is considered a cross-unit call.
Referring to fig. 2, the invocation of the service may be implemented by an RPC framework, which is a remote invocation framework, such as Dubbo, gRPC, etc. framework. The consumer may be a node in the micro-service architecture that initiates the RPC call. The provider may be a node in the micro-service architecture that receives RPC calls. In RPC calls, a service call request contains, in addition to UserID, request parameters, return values, some additional information of the request, such as start time, end time of the request, interface definition of the target service, method list of the target service, timeout time of the service, etc., all of which are collectively referred to as request context.
According to embodiments of the present disclosure, acquisition of UserId may be responsible for invoking a particular module in the link, such as by a traffic conditioner (e.g., load balancing device 160) at the outermost traffic ingress outside the unit, and by the RPC framework at inter-modulation between micro-services within the unit. The target service is the micro-service that is currently requested by the transaction, and can be obtained from the request context.
According to the embodiment of the disclosure, the route calculation module may be a service running independently, or may be a component integrated by other modules on the link for use, and when implemented as a component, for example, may be made into a Jar to be integrated by other modules.
The flow switching method according to the embodiment of the present disclosure will be described in detail below with reference to fig. 3 to 5 based on the descriptions of fig. 1 and 2.
Fig. 3 schematically illustrates a flow chart of a flow switching method according to an embodiment of the present disclosure.
As shown in fig. 3, the flow switching method of this embodiment includes operations S301 to S310.
In operation S301, a service call request to be routed is obtained, where the service call request includes a service call identifier to be routed and a target service.
Referring to fig. 2, the traffic coordinator 220 may obtain a service call request to be routed from outside the unit, and obtain a call identifier to be routed and a target service in the request. Further, a routing computation module within the traffic conditioner may obtain the first mapping rule and the second mapping rule from the configuration center.
Each first unit may obtain a service call request to be routed generated in the unit, and obtain a call identifier to be routed and a target service in the request. Further, the route calculation module within the first cell may obtain the first mapping rule and the second mapping rule from the configuration center.
Wherein the routing computation module may cache the first mapping rule and the second mapping rule locally without having to read from the configuration center every computation, thereby providing performance. Operations S302 to S310 may be performed using the route calculation module.
In operation S302, it is determined whether there is a call identifier to be routed in the first mapping rule. If yes, operation S303 is executed, and if no, operation S307 is executed.
According to an embodiment of the present disclosure, the first mapping rule and the second mapping rule may be configured in a traffic routing table. For example, a first mapping rule is configured in a service dimension table and a second mapping rule is configured in a unit dimension table, in which case the traffic routing table includes a service dimension table and a unit dimension table. Or the first mapping rule and the second mapping rule are configured in the same routing table, in which case the traffic routing table is a routing table.
Taking the configuration of the first mapping rule in the service dimension table and the configuration of the second mapping rule in the unit dimension table as an example, whether the call identifier to be routed has a corresponding entry in the service dimension table or not can be determined, and if yes, the existence is confirmed.
In operation S303, it is determined whether or not there is a target service in the first mapping relation. If yes, operation S304 is executed, and if no, operation S307 is executed.
In accordance with an embodiment of the present disclosure, in the case where there is a to-be-routed call identifier in the first mapping rule, in operation S303, if the target service is not determined based on the first mapping relationship, operation S307 is performed to route the service call request to the second target unit.
According to an embodiment of the disclosure, a call identifier column, a cell column and a service column may be included in the service dimension table, each cell under the identifier column may be configured with one or more call identifiers, each cell under the service column may be configured with one or more services, and each cell under the cell column is configured with a cell number. The data for each row may determine the mapping between call identifications, units, and services. Table 3 schematically shows the first mapping rule content of the service dimension table. The last two digits of "UserId" are the call identifier column, "target unit" is the unit column, and "service list" is the service column.
TABLE 3 Table 3
After the to-be-routed call identifier is determined in the service dimension table, the data where the to-be-routed call identifier is located comprises a first mapping relation, so that a service list in a service column of the row is obtained. It is determined whether the target service exists in the service list.
In operation S304, it is determined whether the first target unit exists in the first mapping relationship. If yes, operation S305 is performed, and if no, operation S307 is performed.
In operation S305, a first target unit is determined based on the first mapping relation.
And determining whether a unit number exists in the unit column in the row data where the call identifier to be routed is located, and if the unit number exists, taking the unit number as a first target unit.
In operation S306, if the to-be-routed call identifier exists in the first mapping rule, if the target service is determined based on the first mapping relationship, the service call request is routed to the first target unit, where the first target unit is deployed with the target service, and the first mapping rule includes the to-be-routed call identifier, the target service, and the first mapping relationship between the first target unit.
In operation S307, it is determined whether there is a call identifier to be routed in the second mapping rule. If yes, operation S308 is executed, and if no, the process ends.
According to embodiments of the present disclosure, referring to tables 1 and 2, the last two digits of the call identifier column "UserId" and the cell column "target cell" may be included in the cell dimension table, and each cell under the identifier column may be configured with one or more call identifiers, with each cell under the cell column being configured with a cell number. The data for each row may determine the call identifier, the mapping between the cells.
In operation S308, it is determined whether a second target unit exists in the second mapping relationship. If yes, operation S309 is executed, and if no, ending.
In operation S309, a second target unit is determined based on the second mapping relationship.
After the to-be-routed call identifier is determined in the unit dimension table, the data of the to-be-routed call identifier comprises a second mapping relation, so that the unit number configured by the unit column of the row is obtained. The unit number is taken as a second target unit.
In operation S310, if the to-be-routed call identifier does not exist in the first mapping rule, determining a second target unit based on a second mapping relationship in the second mapping rule, and routing the service call request to the second target unit, where the second target unit is deployed with the target service, and the second mapping rule includes the second mapping relationship between the to-be-routed call identifier and the second target unit.
According to an embodiment of the present disclosure, after obtaining a service call request to be routed, first, it is determined whether there is a call identifier to be routed in a first mapping rule. And secondly, if the to-be-routed call identifier exists, determining whether the target service exists according to the first mapping relation. And if the target service exists, routing the service call request to a first target unit in the first mapping relation. In addition, if the first mapping rule does not have the to-be-routed call identifier or the target service of the service call request, determining that the second target unit performs routing according to the second mapping relation in the second mapping rule. By setting the second mapping rule and the first mapping rule, the flow switching requirement of the unit dimension or the service dimension can be better met, the switching granularity is finer, and the flexibility is higher.
Fig. 4 schematically illustrates a flow chart of setting a second mapping rule according to an embodiment of the disclosure.
As shown in fig. 4, before operation S307, setting the second mapping rule of this embodiment includes operations S410 to S420.
In operation S410, N first units are obtained, wherein M services are deployed in each first unit, and N, M is an integer greater than or equal to 1, respectively.
In operation S420, a third mapping relationship between each first unit and at least one call identifier is set based on a first routing rule, where the first routing rule includes a setting rule using the unit as a routing unit, and the third mapping relationship includes a second mapping relationship.
Referring to fig. 1, 2 and table 1, for example, 5 first units Zone1, zone2, zone3, zone4, zone5 are included under a distributed system. In some embodiments, if the third mapping relationship is set according to the last two digits (between 00 and 99) of the userID, every 20 tail numbers may be divided into a section, and the userID in each section has the third mapping relationship with one first unit. For example, if the last two digits of the to-be-routed identifier userID are 00, the corresponding second target unit is Zone1, and a second mapping relationship exists between the last two digits. Wherein the last two digits of UserID from different users may be the same.
It should be noted that the present disclosure is not limited to setting the third mapping relationship according to the last two digits of UserID. For example, the settings may be by region identification, device identification, or identification that may characterize a user, etc. When the third mapping relation is set according to the region identification, the third mapping relation can be set between different regions and the first unit. When the device identifier is set, a third mapping relationship can be set between different terminal devices and the first unit. When an identification setting is made that characterizes a user, all requests of a user can be routed to a first unit.
According to an embodiment of the present disclosure, the traffic switching method of this embodiment further includes setting a first mapping rule, and specifically includes: and setting a fourth mapping relation between any calling identifier and any first unit and at least one service in the first unit based on a second routing rule, wherein the second routing rule comprises a setting rule taking the service as a routing unit.
Through the second mapping rule, traffic switching with the unit as a routing unit can be realized. On the basis, the first mapping rule is combined, and when the service call request is routed, the priority of the fourth mapping relation is higher, so that the target unit can be obtained according to the determined target service in the first mapping relation in the fourth mapping relation. Specifically, the service list mapped is determined by calling the identifier, and if the target service exists in the service list, the request is routed to the target unit through the mapping between the service list and the target unit, so that the service granularity is switched.
In some embodiments, only the unit dimension table may be used when no traffic switching is performed, as shown in table 1. In this case, when the flow rate in the cell dimension is switched, a certain cell number may be modified to a target cell to be switched, as shown in table 2.
In other embodiments, the unit dimension table may remain unchanged when traffic switching for the service dimension is performed, as shown in table 1. The service dimension table configures the mapping relation among the calling identification list, the service list and the target unit. Referring to tables 1 and 3, if traffic of two services, namely ServiceA and ServiceB, which should be originally sent to Zone1 is switched to Zone4 and the other services are not active, a fourth mapping relationship of UserID tail number intervals 00 to 19, zone4, serviceA and ServiceB may be set in table 3.
For example, in operation S302, it is determined that the identifier of the call to be routed does not exist in the first mapping rule, and if at this time or during the next routing, the service dimension is switched to the identifier of the call to be routed, and a certain service that is called by the identifier is routed to other units. Then a first mapping relationship between the call identifier to be routed and the first target unit, the target service may be set based on the second routing rule. The fourth mapping relationship in the service dimension table includes the first mapping relationship.
In other embodiments, for example, in operation S302, it is determined that the call identifier to be routed exists in the first mapping rule, and when there is a traffic switching requirement for the unit dimension on the basis of routing through the service dimension table, the mapping relationship in the service dimension table may be modified, or the unit number in the unit dimension table may be adjusted, and the corresponding mapping relationship in the service dimension table may be deleted. This is further illustrated by fig. 5 below.
Fig. 5 schematically illustrates a flow chart for traffic switching in the unit dimension according to an embodiment of the disclosure.
As shown in fig. 5, the flow switching in the unit dimension of this embodiment may include operations S510 to S520. The operations S510 to S520 may be performed alternatively or in combination. The first mapping relation comprises a call identifier list and a service list, wherein the call identifier list comprises a call identifier to be routed, and the service list comprises a target service.
At least one of the list of identifications, the first target unit, and the list of services is invoked in the first mapping relationship is modified in operation S510.
In operation S520, the second target unit in the second mapping relationship is modified to a third target unit.
If tables 1 and 3 exist together, when all traffic destined for Zone1 is to be switched to Zone4, an alternative way is to perform only operation S510, where the service list in the first mapping relationship is modified, for example, all services in Zone4 are filled in the service list. Alternatively, operations S510 and S520 are performed to delete the first mapping relation, that is, delete all of the call identifier list, the first target unit, and the service list, and modify Zone1 in table 1 to Zone4, as shown in table 2.
If tables 1 and 3 exist at the same time, in order to switch the traffic of ServiceA and ServiceB of Zone3 to Zone4, only operation S510 may be executed, a first mapping relationship is newly added, and mapping relationships between UserID tail numbers 40 to 59, zone4, serviceA and ServiceB are established. Or if the flow rates of ServiceA and ServiceB of Zone3 are to be switched to Zone4, the flow rates of ServiceA and ServiceB of Zone1 no longer need to be switched, and the UserID tail numbers 00-19 in the current table 3 are modified to UserID tail numbers 40-59.
Based on the flow switching method, the disclosure further provides a flow switching device. The device will be described in detail below in connection with fig. 6.
Fig. 6 schematically illustrates a block diagram of a flow switching device 600 according to an embodiment of the present disclosure.
As shown in fig. 6, the flow switching apparatus 600 of this embodiment includes a request acquisition module 610, a first routing module 620, and a second routing module 630.
The request acquisition module 610 may perform operation S301, configured to acquire a service call request to be routed, where the service call request includes a call identifier to be routed and a target service.
The first routing module 620 may perform operation S306, configured to route the service invocation request to the first target unit if the target service is determined based on the first mapping relationship in the case that the to-be-routed invocation identification exists in the first mapping rule, where the first target unit has the target service deployed therein, and the first mapping rule includes the to-be-routed invocation identification, the target service, and the first mapping relationship between the first target unit.
The second routing module 630 may perform operation S310, configured to determine, if the to-be-routed call identifier does not exist in the first mapping rule, a second target unit based on a second mapping relationship in the second mapping rule, and route the service call request to the second target unit, where the second target unit is deployed with the target service, and the second mapping rule includes a second mapping relationship between the to-be-routed call identifier and the second target unit.
Any of the plurality of modules of the request acquisition module 610, the first routing module 620, and the second routing module 630 may be combined in one module to be implemented, or any of the plurality of modules may be split into a plurality of modules, according to embodiments of the present disclosure. Alternatively, at least some of the functionality of one or more of the modules may be combined with at least some of the functionality of other modules and implemented in one module.
According to embodiments of the present disclosure, at least one of the request acquisition module 610, the first routing module 620, and the second routing module 630 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable way of integrating or packaging circuitry, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, at least one of the request acquisition module 610, the first routing module 620, and the second routing module 630 may be at least partially implemented as a computer program module, which when executed, may perform the corresponding functions.
Fig. 7 schematically illustrates a block diagram of an electronic device adapted to implement a flow switching method according to an embodiment of the disclosure.
As shown in fig. 7, an electronic device 700 according to an embodiment of the present disclosure includes a processor 701 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. The processor 701 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. The processor 701 may also include on-board memory for caching purposes. The processor 701 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 703, various programs and data necessary for the operation of the electronic apparatus 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. The processor 701 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 702 and/or the RAM 703. Note that the program may be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the electronic device 700 may further include an input/output (I/O) interface 705, the input/output (I/O) interface 705 also being connected to the bus 704. The electronic device 700 may also include one or more of the following components connected to the I/O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output portion 707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 708 including a hard disk or the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 702 and/or RAM 703 and/or one or more memories other than ROM 702 and RAM 703 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. The program code, when executed in a computer system, causes the computer system to perform the methods provided by embodiments of the present disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 701. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed over a network medium in the form of signals, downloaded and installed via the communication section 709, and/or installed from the removable medium 711. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 701. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be provided in a variety of combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (10)

1. A method of traffic switching, comprising:
acquiring a service call request to be routed, wherein the service call request comprises a service call identifier to be routed and a target service;
Under the condition that the to-be-routed call identifier exists in a first mapping rule, if the target service is determined based on a first mapping relation, routing the service call request to a first target unit, wherein the target service is deployed in the first target unit, and the first mapping rule comprises the to-be-routed call identifier, the target service and the first mapping relation among the first target unit;
determining a second target unit based on a second mapping relation in a second mapping rule under the condition that the to-be-routed call identifier does not exist in the first mapping rule, and routing the service call request to the second target unit, wherein the target service is deployed in the second target unit, and the second mapping rule comprises the second mapping relation between the to-be-routed call identifier and the second target unit;
the call identifier includes the call identifier to be routed, and before the second target unit is determined based on the second mapping relation in the second mapping rule, the call identifier further includes setting the second mapping rule, specifically including:
obtaining N first units, wherein the N first units comprise the second target units, M services are deployed in each first unit, and N, M is an integer greater than or equal to 1;
Setting a third mapping relation between each first unit and at least one calling identifier based on a first routing rule, wherein the first routing rule comprises a setting rule taking a unit as a routing unit, and the third mapping relation comprises the second mapping relation;
the method further comprises setting the first mapping rule, and specifically comprises the following steps:
and setting a fourth mapping relation between any one of the calling identifiers and any one of the first units and at least one service in the first unit based on a second routing rule, wherein the second routing rule comprises a setting rule taking the service as a routing unit.
2. The method of claim 1, wherein the service invocation request is routed to the second target unit if the target service is not determined based on the first mapping relationship, if the to-be-routed call identifier is present in the first mapping rule.
3. The method of claim 1, wherein in the absence of the to-be-routed call identifier in the first mapping rule, the method further comprises:
and setting the first mapping relation between the calling identifier to be routed and the first target unit and the target service based on the second routing rule.
4. The method of claim 1, wherein the first mapping relationship includes a call identifier list and a service list, the call identifier list includes a call identifier to be routed, the service list includes the target service, and the method further includes, in a case where the call identifier to be routed exists in a first mapping rule:
modifying at least one of the call identifier list, the first target unit and the service list in the first mapping relation; and/or
And modifying the second target unit in the second mapping relation into a third target unit.
5. A flow switching device, comprising:
the system comprises a request acquisition module, a service call module and a service request module, wherein the request acquisition module is used for acquiring a service call request to be routed, and the service call request comprises a call identifier to be routed and a target service;
the first routing module is configured to route the service call request to a first target unit if the target service is determined based on a first mapping relationship under the condition that the to-be-routed call identifier exists in a first mapping rule, where the first target unit is deployed with the target service, and the first mapping rule includes the to-be-routed call identifier, the target service, and the first mapping relationship between the first target unit;
The second routing module is configured to determine a second target unit based on a second mapping relationship in a second mapping rule under the condition that the to-be-routed call identifier does not exist in the first mapping rule, and route the service call request to the second target unit, where the second target unit is deployed with the target service, and the second mapping rule includes the second mapping relationship between the to-be-routed call identifier and the second target unit;
the call identifier includes the call identifier to be routed, and before the second target unit is determined based on the second mapping relation in the second mapping rule, the call identifier further includes setting the second mapping rule, specifically including:
obtaining N first units, wherein the N first units comprise the second target units, M services are deployed in each first unit, and N, M is an integer greater than or equal to 1;
setting a third mapping relation between each first unit and at least one calling identifier based on a first routing rule, wherein the first routing rule comprises a setting rule taking a unit as a routing unit, and the third mapping relation comprises the second mapping relation;
The method further comprises setting the first mapping rule, and specifically comprises the following steps:
and setting a fourth mapping relation between any one of the calling identifiers and any one of the first units and at least one service in the first unit based on a second routing rule, wherein the second routing rule comprises a setting rule taking the service as a routing unit.
6. A traffic switching system, comprising:
the configuration center is used for configuring a first mapping rule and a second mapping rule, wherein the first mapping rule comprises a to-be-routed calling identifier, a target service and a first mapping relation between a first target unit, and the second mapping rule comprises a second mapping relation between the to-be-routed calling identifier and a second target unit;
a traffic dispatcher for acquiring the first mapping rule and the second mapping rule from the configuration center according to a service call request to be routed from outside the unit, and executing the traffic switching method of claim 1;
and N first units, wherein each first unit is used for calling the target service in response to the service calling request, each N first units comprises a second target unit and a first target unit, and N is an integer greater than or equal to 1.
7. The system of claim 6, wherein each of the first units is further configured to:
the traffic switching method according to claim 1 is performed according to the service call request to be routed generated in the unit.
8. The system of claim 7, further comprising:
a route calculation module, configured to be disposed in the traffic conditioner and each of the first units, so as to perform the traffic switching method according to claim 1.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-4.
10. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method according to any of claims 1-4.
CN202210019082.9A 2022-01-07 2022-01-07 Traffic switching method, device, system, apparatus, medium and program product Active CN114363339B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210019082.9A CN114363339B (en) 2022-01-07 2022-01-07 Traffic switching method, device, system, apparatus, medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210019082.9A CN114363339B (en) 2022-01-07 2022-01-07 Traffic switching method, device, system, apparatus, medium and program product

Publications (2)

Publication Number Publication Date
CN114363339A CN114363339A (en) 2022-04-15
CN114363339B true CN114363339B (en) 2024-01-30

Family

ID=81107082

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210019082.9A Active CN114363339B (en) 2022-01-07 2022-01-07 Traffic switching method, device, system, apparatus, medium and program product

Country Status (1)

Country Link
CN (1) CN114363339B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107018174A (en) * 2016-12-27 2017-08-04 阿里巴巴集团控股有限公司 A kind of method, device and the transaction processing system of blocking system service processing
CN109450820A (en) * 2018-11-09 2019-03-08 浙江大学 A kind of service switch and service network system of service-oriented network
CN112491943A (en) * 2019-09-12 2021-03-12 北京国双科技有限公司 Data request method, device, storage medium and electronic equipment
CN113556370A (en) * 2020-04-24 2021-10-26 北京沃东天骏信息技术有限公司 Service calling method and device
CN113839865A (en) * 2021-11-30 2021-12-24 北京鲸鲮信息***技术有限公司 Management method and system for cross-domain call service

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107018174A (en) * 2016-12-27 2017-08-04 阿里巴巴集团控股有限公司 A kind of method, device and the transaction processing system of blocking system service processing
CN109450820A (en) * 2018-11-09 2019-03-08 浙江大学 A kind of service switch and service network system of service-oriented network
CN112491943A (en) * 2019-09-12 2021-03-12 北京国双科技有限公司 Data request method, device, storage medium and electronic equipment
CN113556370A (en) * 2020-04-24 2021-10-26 北京沃东天骏信息技术有限公司 Service calling method and device
CN113839865A (en) * 2021-11-30 2021-12-24 北京鲸鲮信息***技术有限公司 Management method and system for cross-domain call service

Also Published As

Publication number Publication date
CN114363339A (en) 2022-04-15

Similar Documents

Publication Publication Date Title
CN113381944B (en) System current limiting method, apparatus, electronic device, medium, and program product
CN115190062B (en) Service processing method and device, electronic equipment and computer readable storage medium
CN112965916B (en) Page testing method, page testing device, electronic equipment and readable storage medium
CN111010453B (en) Service request processing method, system, electronic device and computer readable medium
CN113742389A (en) Service processing method and device
CN113191889A (en) Wind control configuration method, configuration system, electronic device and readable storage medium
US20150063558A1 (en) Systems and methods for allocation of telephony resources on-demand
CN114363339B (en) Traffic switching method, device, system, apparatus, medium and program product
CN116192752A (en) Service flow control method, device, electronic equipment and storage medium
CN112491066B (en) Load balancing method, device, system, target load balancing equipment and medium
CN114006907A (en) Service degradation method and device for distributed server, electronic equipment and medium
CN113556370A (en) Service calling method and device
CN113282391B (en) Cluster switching method, cluster switching device, electronic equipment and readable storage medium
CN111770121A (en) Method and device for service access based on directional flow
CN115174588B (en) Bandwidth control method, device, apparatus, storage medium and program product
CN116582604A (en) Message processing method, device, electronic equipment and storage medium
CN116436855B (en) Data information processing method, device, electronic equipment and medium
CN114268558B (en) Method, device, equipment and medium for generating monitoring graph
CN113760886B (en) Method, apparatus, device and computer readable medium for providing data service
CN116775307A (en) Service processing method, device, equipment and storage medium
CN116627672A (en) Event identification processing method, device, equipment and storage medium
CN115934355A (en) Service degradation method, device, equipment and medium
CN116886774A (en) Request processing method and device, electronic equipment and computer readable storage medium
CN117951150A (en) Database connection method, apparatus, device, storage medium, and program product
CN116680081A (en) Task processing method and device, electronic equipment and 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