CN112653632A - Flow control realization method and device - Google Patents

Flow control realization method and device Download PDF

Info

Publication number
CN112653632A
CN112653632A CN201910953501.4A CN201910953501A CN112653632A CN 112653632 A CN112653632 A CN 112653632A CN 201910953501 A CN201910953501 A CN 201910953501A CN 112653632 A CN112653632 A CN 112653632A
Authority
CN
China
Prior art keywords
cluster
request
node
flow
nodes
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.)
Pending
Application number
CN201910953501.4A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information Technology Co Ltd
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 Beijing Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN201910953501.4A priority Critical patent/CN112653632A/en
Publication of CN112653632A publication Critical patent/CN112653632A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/20Traffic policing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2425Traffic characterised by specific attributes, e.g. priority or QoS for supporting services specification, e.g. SLA
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method and a device for realizing flow control, and relates to the technical field of computers. A specific implementation manner of the method comprises the steps of receiving a request, obtaining preset characteristics in the request, and matching corresponding multi-cluster flow distribution rules; the multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster; and based on a multi-cluster flow distribution rule, the requested flow is guided into a corresponding cluster so as to execute the request. Therefore, the embodiment of the invention can solve the problems of poor flow control flexibility and low availability.

Description

Flow control realization method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for implementing flow control.
Background
In recent years, with the rapid development of the internet, the related traffic flow thereof also shows explosive growth, and the industry generally adopts a reverse proxy server such as a Nginx/Apache/Squid to realize the distribution and control of the traffic flow.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the configuration of the flow control is static configuration and cannot be dynamically adjusted in real time. While nginx may reload the configuration file in a reloaded manner, it is implemented in a manner that a new process is started to service a new request, and the creation of the new process causes the process to need to be reinitialized, possibly resulting in a momentary jitter in the performance of the server.
And if the number of retries of the selected back-end instance exceeds the maximum number, the request can be failed directly, and the high availability is reduced. Meanwhile, the flow control can only be controlled in a single cluster mode, the control mode is simple, the flow control mode of multiple clusters is not supported, and the requirements cannot be met for the common scenes of flow control of multiple machine rooms and multiple clusters.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for implementing flow control, which can solve the problems of poor flexibility and low availability of flow control.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, a method for implementing flow control is provided, including receiving a request, obtaining preset features in the request to match corresponding multi-cluster offloading rules; the multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster; and based on a multi-cluster flow distribution rule, the requested flow is guided into a corresponding cluster so as to execute the request.
Optionally, the directing the requested traffic into a corresponding cluster includes:
acquiring a shunting cluster based on a corresponding multi-cluster shunting rule, and further distributing a shunting interval for each cluster according to a shunting proportion;
generating a random integer by taking the current timestamp as a random factor;
and determining the cluster of the requested traffic import according to the splitting interval to which the random integer belongs.
Optionally, obtaining preset features in the request to match the corresponding multi-cluster offloading rule includes:
and performing preset characteristics in the matching request according to the sequence of the unique resource locator, the head parameter, the variable name of the character string and the user characteristic data to obtain a corresponding multi-cluster flow distribution rule.
Optionally, after the traffic of the request is introduced into the corresponding cluster, the method includes:
carrying out weight value calculation on nodes in the cluster, and acquiring an identifier with the largest weight value as a candidate node; when the weighted value calculation comprises identifying candidate nodes in each round, distributing weighted values to each node in advance, and accumulating the weighted values of each node;
and importing the requested traffic into the candidate node to execute the request.
Optionally, the importing the requested traffic into the candidate node to execute the request includes:
attempting to introduce the requested traffic into the candidate node, and judging whether a response of the candidate node is received;
if yes, returning response information; otherwise, the instance is put into a local public cache, the expiration time is set, the candidate nodes are marked as dead nodes within the expiration time, and then the weight value calculation is carried out on the nodes in the cluster again.
Optionally, after the weight value calculation is performed again on the nodes in the cluster, the method includes:
and if the response of the candidate node is not received, attempting to use the node marked as a spare node in the cluster for weight value calculation, and taking the node with the maximum weight as the candidate node to execute the request.
Optionally, attempting to use a node marked as a spare node in the cluster for weight value calculation, and taking the node with the highest weight as a candidate node, so as to execute the request, includes:
and if the response of the candidate node is not received, the corresponding multi-cluster flow distribution rule is matched again, and the requested flow is guided into the corresponding cluster based on the re-matched multi-cluster flow distribution rule so as to execute the request.
In addition, according to an aspect of the embodiments of the present invention, there is provided a flow control implementation apparatus, including a receiving module, configured to receive a request, and obtain a preset feature in the request, so as to match a corresponding multi-cluster offloading rule; the multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster; and the processing module is used for guiding the requested flow into a corresponding cluster based on a multi-cluster flow distribution rule so as to execute the request.
Optionally, the step of the processing module importing the requested traffic into a corresponding cluster includes:
acquiring a shunting cluster based on a corresponding multi-cluster shunting rule, and further distributing a shunting interval for each cluster according to a shunting proportion;
generating a random integer by taking the current timestamp as a random factor;
and determining the cluster of the requested traffic import according to the splitting interval to which the random integer belongs.
Optionally, the obtaining, by the receiving module, the preset feature in the request to match the corresponding multi-cluster offloading rule includes:
and performing preset characteristics in the matching request according to the sequence of the unique resource locator, the head parameter, the variable name of the character string and the user characteristic data to obtain a corresponding multi-cluster flow distribution rule.
Optionally, after the processing module directs the requested traffic to the corresponding cluster, the method includes:
carrying out weight value calculation on nodes in the cluster, and acquiring an identifier with the largest weight value as a candidate node; when the weighted value calculation comprises identifying candidate nodes in each round, distributing weighted values to each node in advance, and accumulating the weighted values of each node;
and importing the requested traffic into the candidate node to execute the request.
Optionally, the process module directs the requested traffic to the candidate node to execute the request, including:
attempting to introduce the requested traffic into the candidate node, and judging whether a response of the candidate node is received;
if yes, returning response information; otherwise, the instance is put into a local public cache, the expiration time is set, the candidate nodes are marked as dead nodes within the expiration time, and then the weight value calculation is carried out on the nodes in the cluster again.
Optionally, after the processing module performs the weight value calculation again on the nodes in the cluster, the processing module includes:
and if the response of the candidate node is not received, attempting to use the node marked as a spare node in the cluster for weight value calculation, and taking the node with the maximum weight as the candidate node to execute the request.
Optionally, the processing module attempts to perform weight value calculation by using a node marked as a spare node in the cluster, and takes the node with the highest weight as a candidate node, so as to execute the request, including:
and if the response of the candidate node is not received, the corresponding multi-cluster flow distribution rule is matched again, and the requested flow is guided into the corresponding cluster based on the re-matched multi-cluster flow distribution rule so as to execute the request.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the flow control implementation embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, the program, when executed by a processor, implementing the method according to any of the above embodiments of implementing the flow control based method.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of receiving a request, obtaining preset characteristics in the request to match a corresponding multi-cluster flow distribution rule; the multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster; and based on a multi-cluster flow distribution rule, the requested flow is guided into a corresponding cluster so as to execute the request. Therefore, the invention can realize high-availability, dynamic and high-efficiency flow control.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a flow control implementation method according to a first embodiment of the present invention
Fig. 2 is a schematic diagram of a main flow of a flow control implementation method according to a second embodiment of the present invention;
fig. 3 is a schematic diagram of a main flow of a flow control implementation method according to a third embodiment of the present invention;
fig. 4 is a schematic diagram of a main flow of a flow control implementation method according to a fourth embodiment of the present invention;
fig. 5 is a schematic diagram of main blocks of a flow control realization apparatus according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a flow control implementation method according to a first embodiment of the present invention, where the flow control implementation method may include:
step S101, receiving a request, and acquiring preset characteristics in the request to match a corresponding multi-cluster flow distribution rule.
The multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster.
Further, the multi-cluster offload rules allow for matching rules to be specified according to HTTP features, such as matching rules according to information such as URLs, parameters, HTTP headers, etc. of HTTP requests. Preferably, the requests meeting the specified characteristics are shunted to the cluster specified in the "routing rule configuration", and the requests not meeting the specified cluster according to the "default routing rule configuration". In addition, a flow control rule can be set for a user according to user characteristic data (such as pin, erp account and the like, which are collectively called pin on an interface).
As an embodiment of the present invention, matching HTTP request features is performed in the order of Url (unique resource locator), Header (Header parameter), Args (string variable name), and User (User feature data), and if there is one match, the HTTP request features are returned as true, and if none of the matches are returned as false, and at the same time, the corresponding multi-cluster offloading rule can be hit.
It is also worth noting that the multi-cluster offload rule supports proportional offload to different clusters.
And step S102, based on a multi-cluster flow distribution rule, introducing the requested flow into a corresponding cluster so as to execute the request.
Preferably, the distribution clusters can be obtained based on the corresponding multi-cluster distribution rule, and the distribution interval is allocated to each cluster according to the distribution proportion. And taking the current time stamp as a random factor to generate a random integer. And determining the cluster of the requested traffic import according to the splitting interval to which the random integer belongs. Preferably, the time stamp is accurate to milliseconds.
For example: A. b, C the flow rate ratio is A (30%), B (10%) and C (60%), the division interval is A (0-30), B (30-40) and C (40-100). And taking the current timestamp as a random factor, generating a random integer which is greater than 0 and smaller than 100, and determining which cluster the traffic needs to be allocated to when the random integer falls in the proportion interval of which cluster.
In addition, the process for shunting in the cluster comprises the following steps:
and carrying out weight value calculation on the nodes in the cluster, and acquiring the identifier with the maximum weight value as a candidate node. When the weighted value calculation includes that each round of candidate node is identified, the weighted value is distributed to each node in advance, and the weighted value of each node is accumulated. And importing the requested traffic into the candidate node to execute the request.
Further, the requested traffic is tried to be led into the candidate node, and whether the response of the candidate node is received or not is judged. If yes, response information is returned. Otherwise, the instance is put into a local public cache, the expiration time is set, the candidate nodes are marked as dead nodes within the expiration time, and then the weight value calculation is carried out on the nodes in the cluster again.
Further, maintenance may be performed on each node within the cluster, such as connection timeout, read timeout, send timeout, and auto-revive time for each node. The automatic revival time refers to how long the node is automatically shielded when the nodes in the cluster cannot be connected, and after the time is exceeded, the automatic attempt is made to hit the traffic to the node, that is, the set expiration time is set.
Preferably, a plurality of instance nodes can also be added, i.e. a plurality of nodes are added in the cluster. Each node can independently set weight, whether to be standby or not and whether to stop the identification, whether to be standby or not identifies the node as a standby node, and when the non-standby node and the non-stop node are not available, the flow is hit to the instance node identified as standby.
It should be noted that, when performing flow control, the technique stack of Nginx + OpenResty + Lua may be used as a reference. And the multi-cluster and multi-cluster splitting rules can be processed with metadata, respectively. Further, a Restful mode is used for providing services for flow control calls to acquire metadata of the multi-cluster and multi-cluster shunting rules.
The Restful mode provides a set of design principles and constraints for a software architecture style and a design style. Nginx is a high performance HTTP and reverse proxy web service. OpenResty is a high-performance Web platform based on Nginx and Lua. Lua is a lightweight and compact scripting language.
In conclusion, the invention can solve the problem of how to effectively manage and control the flow of the back-end instance under the scene of high concurrent flow of the internet, and has the significance of being popularized to other fields and scenes for flow control.
Fig. 2 is a schematic diagram of a main flow of a flow control implementation method according to a second embodiment of the present invention, where the flow control implementation method may include:
step S201, receiving a request, and obtaining preset features in the request to match a corresponding multi-cluster distribution rule.
The multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster.
Step S202, acquiring a shunting cluster based on the corresponding multi-cluster shunting rule, and further allocating a shunting interval for each cluster according to a shunting proportion.
Step S203, a random integer is generated with the current timestamp as a random factor.
Preferably, the time stamp is accurate to milliseconds.
And step S204, determining the cluster into which the requested flow is led according to the flow distribution interval to which the random integer belongs.
Step S205, according to the import cluster, executes the request.
Fig. 3 is a schematic diagram of a main flow of a flow control implementation method according to a third embodiment of the present invention, where the flow control implementation method may include:
step S301, receiving a request, and acquiring preset characteristics in the request to match a corresponding multi-cluster flow distribution rule.
The multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster.
Step S302, based on the corresponding multi-cluster flow distribution rule, the requested flow is introduced into the corresponding cluster.
Step S303, carrying out weight value calculation on the nodes in the cluster, and acquiring the identifier with the largest weight value as a candidate node.
When the weighted value calculation includes that each round of candidate node is identified, the weighted value is distributed to each node in advance, and the weighted value of each node is accumulated.
Preferably, the weight value calculation is performed on the non-standby, non-inactive and non-dead nodes in the cluster, and the node with the largest weight is identified as the candidate node. The method comprises the steps of distributing a weight value to each routing node in advance, accumulating a next weight value for each routing node in each selection round, and selecting a node with the largest accumulated value as a candidate node.
Step S304, importing the requested traffic into the candidate node to execute the request.
Fig. 4 is a schematic diagram of a main flow of a flow control implementation method according to a fourth embodiment of the present invention, where the flow control implementation method may include:
step S401, receiving a request, and acquiring preset characteristics in the request to match a corresponding multi-cluster flow distribution rule.
The multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster.
Step S402, the requested flow is led into a corresponding cluster.
Step S403, performing weight value calculation on the nodes in the cluster, and acquiring the identifier with the largest weight value as a candidate node.
When the weighted value calculation includes that each round of candidate node is identified, the weighted value is distributed to each node in advance, and the weighted value of each node is accumulated.
Step S404, attempting to introduce the requested traffic into the candidate node, determining whether a response of the candidate node is received, determining whether a response is received, if yes, performing step S405, and if not, performing step S406.
Preferably, the instruction balance _ by _ lua _ block of OpenResty is used to attempt to direct the request traffic to the candidate node.
In step S405, response information is returned.
Preferably, the candidate node normal response is received and the response is returned to the requesting client.
Step S406, the instance is placed in a local public cache, an expiration time is set, the candidate node is marked as a dead node within the expiration time, and the step S403 is returned.
Preferably, if no response of the candidate node is received, the connection fails, the instance is placed in the local public cache ngx.shared.dict of OpenResty, and the expiration time is set to be the "automatic revival time" of the cluster where the node is located, the node is marked as a dead node in the automatic revival time, and then the step S403 is returned to recalculate a new candidate node.
It should be noted that if no available node can be found, the nodes marked as backup in the cluster are tried to be used for weight calculation, and the node with the highest weight is found and identified as a candidate node. And if the available nodes can not be found in the standby nodes, re-matching the corresponding multi-cluster distribution rule and re-selecting the cluster. Of course, if no available node can still be found, the client is responded 503 with an error.
Fig. 5 is a schematic diagram of main blocks of a flow control implementation apparatus according to a first embodiment of the present invention, and as shown in fig. 5, the flow control implementation apparatus 500 includes a receiving module 501 and a processing module 502. The receiving module 501 is configured to receive a request, and obtain a preset feature in the request to match a corresponding multi-cluster offloading rule. The multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster. The processing module 502 is configured to import the requested traffic into a corresponding cluster based on a multi-cluster offloading rule, so as to execute the request.
Preferably, the processing module 502 directs the requested traffic to a corresponding cluster, including:
and acquiring a shunting cluster based on the corresponding multi-cluster shunting rule, and further distributing a shunting interval for each cluster according to a shunting proportion. And taking the current time stamp as a random factor to generate a random integer. And determining the cluster of the requested traffic import according to the splitting interval to which the random integer belongs.
In addition, the receiving module 501 obtains preset features in the request to match with the corresponding multi-cluster offloading rule, including:
and performing preset characteristics in the matching request according to the sequence of the unique resource locator, the head parameter, the variable name of the character string and the user characteristic data to obtain a corresponding multi-cluster flow distribution rule.
Preferably, after the processing module 502 directs the requested traffic to the corresponding cluster, the method includes:
and carrying out weight value calculation on the nodes in the cluster, and acquiring the identifier with the maximum weight value as a candidate node. When the weighted value calculation includes that each round of candidate node is identified, the weighted value is distributed to each node in advance, and the weighted value of each node is accumulated. And importing the requested traffic into the candidate node to execute the request.
Further, the processing module 502 directs the requested traffic to the candidate node to execute the request, including:
and attempting to guide the requested traffic into the candidate node, and judging whether a response of the candidate node is received. If yes, returning response information; otherwise, the instance is put into a local public cache, the expiration time is set, the candidate nodes are marked as dead nodes within the expiration time, and then the weight value calculation is carried out on the nodes in the cluster again.
It should be noted that, after the processing module 502 performs the weight value calculation again on the nodes in the cluster, if no response of the candidate node is received, the processing module tries to perform the weight value calculation using the node marked as a spare node in the cluster, and uses the node with the highest weight as the candidate node to execute the request.
Further, the processing module 502 tries to perform weight value calculation using the node marked as a spare node in the cluster, and the node with the largest weight is taken as a candidate node, so that after the request is executed, if no response of the candidate node is received, the corresponding multi-cluster offloading rule is re-matched, and based on the re-matched multi-cluster offloading rule, the requested traffic is introduced into the corresponding cluster, so as to execute the request.
It should be noted that, the flow control implementation method and the flow control implementation device of the present invention have corresponding relation in the specific implementation content, and therefore, the repeated content is not described again.
Fig. 6 illustrates an exemplary system architecture 600 to which a flow control implementation method or flow control implementation apparatus of an embodiment of the invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for implementing flow control provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the apparatus for implementing flow control is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with 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. In the RAM703, various programs and data necessary for the operation of the system 700 are also stored. The CPU801, ROM702, and RAM703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and 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. A 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 out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, 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), an optical fiber, 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 present invention, 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. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart 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 invention. 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.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a receiving module and a processing module. Wherein the names of the modules do not in some cases constitute a limitation of the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: receiving a request, and acquiring preset characteristics in the request to match a corresponding multi-cluster flow distribution rule; the multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster; and based on a multi-cluster flow distribution rule, the requested flow is guided into a corresponding cluster so as to execute the request.
According to the technical scheme of the embodiment of the invention, the problems of poor flow control flexibility and low availability can be solved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for implementing flow control is characterized by comprising the following steps:
receiving a request, and acquiring preset characteristics in the request to match a corresponding multi-cluster flow distribution rule; the multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster;
and based on a multi-cluster flow distribution rule, the requested flow is guided into a corresponding cluster so as to execute the request.
2. The method of claim 1, wherein directing the requested traffic into a corresponding cluster comprises:
acquiring a shunting cluster based on a corresponding multi-cluster shunting rule, and further distributing a shunting interval for each cluster according to a shunting proportion;
generating a random integer by taking the current timestamp as a random factor;
and determining the cluster of the requested traffic import according to the splitting interval to which the random integer belongs.
3. The method of claim 1, wherein obtaining preset features in the request to match corresponding multi-cluster offload rules comprises:
and performing preset characteristics in the matching request according to the sequence of the unique resource locator, the head parameter, the variable name of the character string and the user characteristic data to obtain a corresponding multi-cluster flow distribution rule.
4. The method of claim 1, wherein after directing the requested traffic into the corresponding cluster, comprising:
carrying out weight value calculation on nodes in the cluster, and acquiring an identifier with the largest weight value as a candidate node; when the weighted value calculation comprises identifying candidate nodes in each round, distributing weighted values to each node in advance, and accumulating the weighted values of each node;
and importing the requested traffic into the candidate node to execute the request.
5. The method of claim 4, wherein directing the requested traffic to the candidate node to perform the request comprises:
attempting to introduce the requested traffic into the candidate node, and judging whether a response of the candidate node is received;
if yes, returning response information; otherwise, the instance is put into a local public cache, the expiration time is set, the candidate nodes are marked as dead nodes within the expiration time, and then the weight value calculation is carried out on the nodes in the cluster again.
6. The method of claim 5, wherein after the re-performing the weight value calculation on the nodes in the cluster, the method comprises:
and if the response of the candidate node is not received, attempting to use the node marked as a spare node in the cluster for weight value calculation, and taking the node with the maximum weight as the candidate node to execute the request.
7. The method of claim 6, wherein attempting to use nodes marked as spare nodes in the cluster for weight value calculation, and taking the node with the highest weight as a candidate node, comprises:
and if the response of the candidate node is not received, the corresponding multi-cluster flow distribution rule is matched again, and the requested flow is guided into the corresponding cluster based on the re-matched multi-cluster flow distribution rule so as to execute the request.
8. A flow control realization apparatus, comprising:
the receiving module is used for receiving the request, acquiring preset characteristics in the request and matching the corresponding multi-cluster flow distribution rule; the multi-cluster distribution rule comprises distribution clusters and distribution proportion of each cluster;
and the processing module is used for guiding the requested flow into a corresponding cluster based on a multi-cluster flow distribution rule so as to execute the request.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN201910953501.4A 2019-10-09 2019-10-09 Flow control realization method and device Pending CN112653632A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910953501.4A CN112653632A (en) 2019-10-09 2019-10-09 Flow control realization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910953501.4A CN112653632A (en) 2019-10-09 2019-10-09 Flow control realization method and device

Publications (1)

Publication Number Publication Date
CN112653632A true CN112653632A (en) 2021-04-13

Family

ID=75342517

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910953501.4A Pending CN112653632A (en) 2019-10-09 2019-10-09 Flow control realization method and device

Country Status (1)

Country Link
CN (1) CN112653632A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472687A (en) * 2021-07-15 2021-10-01 北京京东振世信息技术有限公司 Data processing method and device
CN114070889A (en) * 2021-11-10 2022-02-18 北京百度网讯科技有限公司 Configuration method, traffic forwarding method, device, storage medium, and program product
CN115348214A (en) * 2022-07-29 2022-11-15 京东科技信息技术有限公司 Data flow management and control method, device and system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103118076A (en) * 2013-01-11 2013-05-22 烽火通信科技股份有限公司 Upgraded server cluster system and load balancing method thereof
CN107204933A (en) * 2016-03-16 2017-09-26 华为技术有限公司 Distributed stream amount adjustment method and device
CN107861810A (en) * 2017-09-25 2018-03-30 平安普惠企业管理有限公司 Service distributing control method, device, equipment and storage medium
CN109873732A (en) * 2017-12-05 2019-06-11 北京京东尚科信息技术有限公司 Test method and device for proxy server
CN110049143A (en) * 2019-05-31 2019-07-23 华迪计算机集团有限公司 Load-balancing method and device
CN110120917A (en) * 2019-06-28 2019-08-13 北京百度网讯科技有限公司 Method for routing and device based on content

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103118076A (en) * 2013-01-11 2013-05-22 烽火通信科技股份有限公司 Upgraded server cluster system and load balancing method thereof
CN107204933A (en) * 2016-03-16 2017-09-26 华为技术有限公司 Distributed stream amount adjustment method and device
CN107861810A (en) * 2017-09-25 2018-03-30 平安普惠企业管理有限公司 Service distributing control method, device, equipment and storage medium
CN109873732A (en) * 2017-12-05 2019-06-11 北京京东尚科信息技术有限公司 Test method and device for proxy server
CN110049143A (en) * 2019-05-31 2019-07-23 华迪计算机集团有限公司 Load-balancing method and device
CN110120917A (en) * 2019-06-28 2019-08-13 北京百度网讯科技有限公司 Method for routing and device based on content

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王利萍: "基于Nginx服务器集群负载均衡技术的研究与改进" *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472687A (en) * 2021-07-15 2021-10-01 北京京东振世信息技术有限公司 Data processing method and device
CN113472687B (en) * 2021-07-15 2023-12-05 北京京东振世信息技术有限公司 Data processing method and device
CN114070889A (en) * 2021-11-10 2022-02-18 北京百度网讯科技有限公司 Configuration method, traffic forwarding method, device, storage medium, and program product
CN114070889B (en) * 2021-11-10 2023-11-14 北京百度网讯科技有限公司 Configuration method, traffic forwarding device, storage medium, and program product
CN115348214A (en) * 2022-07-29 2022-11-15 京东科技信息技术有限公司 Data flow management and control method, device and system

Similar Documents

Publication Publication Date Title
CN113037869B (en) Method and apparatus for back-sourcing of content distribution network system
CN112653632A (en) Flow control realization method and device
CN110321252B (en) Skill service resource scheduling method and device
CN111478781B (en) Message broadcasting method and device
CN111385129A (en) Globalization content auditing method and device, computer equipment and storage medium
CN110650209A (en) Method and device for realizing load balance
CN112104679B (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
US9736082B2 (en) Intelligent high-volume cloud application programming interface request caching
CN110798495B (en) Method and server for end-to-end message push in cluster architecture mode
CN110245014B (en) Data processing method and device
CN114296953A (en) Multi-cloud heterogeneous system and task processing method
CN110247847B (en) Method and device for back source routing between nodes
CN111831503A (en) Monitoring method based on monitoring agent and monitoring agent device
US20210037090A1 (en) Systems and Methods for Server Failover and Load Balancing
US20170155711A1 (en) Processing Requests
CN113556370A (en) Service calling method and device
CN112968975B (en) Service request processing method and device
CN113132480B (en) Data transmission method, device and system
CN114793234B (en) Message processing method, device, equipment and storage medium
EP3993366B1 (en) Network load balancer, request message distribution method, program product and system
CN113760523A (en) Redis high hot spot data migration method
CN113676503A (en) User request processing method and device, electronic equipment and storage medium
CN113448652A (en) Request processing method and device
JP2023031248A (en) Edge computing network, data transmission method, apparatus, device, and storage medium
CN113760179A (en) Data processing method and device

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