CN114172902A - Flow control method and system for service cluster - Google Patents

Flow control method and system for service cluster Download PDF

Info

Publication number
CN114172902A
CN114172902A CN202111344771.9A CN202111344771A CN114172902A CN 114172902 A CN114172902 A CN 114172902A CN 202111344771 A CN202111344771 A CN 202111344771A CN 114172902 A CN114172902 A CN 114172902A
Authority
CN
China
Prior art keywords
traffic
flow
value
service
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111344771.9A
Other languages
Chinese (zh)
Other versions
CN114172902B (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet 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 Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202111344771.9A priority Critical patent/CN114172902B/en
Publication of CN114172902A publication Critical patent/CN114172902A/en
Application granted granted Critical
Publication of CN114172902B publication Critical patent/CN114172902B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a method and a system for controlling the flow of a service cluster, comprising the following steps: the method comprises the steps that the server side counts the traffic accumulated value of each service instance in a call chain of the server side in the current working time period of the service instance; the server executes the flow control operation on the service instance according to the flow accumulated value and sends a flow value processing request to the flow limiting processing end; and the flow limiting processing end distributes a flow counteracting value to the flow accumulated value according to the remaining amount of the total amount of the flow to be distributed of the call chain, the flow accumulated value and the flow counteracting value are subtracted, the processing result is sent to the server, and the server executes the flow control operation on the call chain in the next working time period according to the processing result. The flow limiting operation can be carried out locally, remote dictionary service at a far end does not need to be accessed, and the server side only accesses the remote dictionary service when flow processing is carried out, so that the flow generated by flow processing is small, and excessive pressure cannot be caused to the load of the remote dictionary service.

Description

Flow control method and system for service cluster
Technical Field
Embodiments of the present application relate to the field of computer technologies, and in particular, to a method and a system for controlling a flow rate of a service cluster, a method and an apparatus for controlling a flow rate, an electronic device, a computer-readable storage medium, and a computer program product.
Background
The microservice is a common way for a plurality of enterprises to construct software service, is commonly used in a complex scene of multiple machine rooms, high concurrency, multiple services and multiple tenants at present, and can bear an access request from a calling end (a tenant client) and feed back a result after processing the access request. However, when the request amount exceeds the load of the micro service, the stability of the system is damaged, so that the stability of the micro service can be guaranteed by means of current limiting.
In the related art, a server of a micro service generally includes a plurality of service instances, and the plurality of service instances process massive access requests, and the current limiting is performed by introducing a remote statistical center (such as a remote dictionary service) to count the number of access requests and limiting current according to the statistical result. Specifically, each time the service instance receives an access request from a calling end, the service instance requests the statistics center to perform count accumulation, and when the sum of the total access counts of all the service instances of the service end in unit time exceeds a preset total quota count, the service instance performs current limiting, that is, stops processing the current access request and an access request sent by a subsequent calling end.
However, in the current scheme, each time a service instance receives an access request, a statistical center is requested once, and whether the access request is processed is determined according to a request result, so that under a micro-service scene with high concurrency and multiple tenants, the load pressure of the statistical center is very large, the stability of the statistical center is deteriorated, the delay is increased, the delay of a calling end for obtaining a processing result is further increased, and the service quality is reduced.
Disclosure of Invention
Embodiments of the present application provide a method and a system for traffic control of a service cluster, a method and an apparatus for traffic control, an electronic device, a computer-readable storage medium, and a computer program product, so as to solve a problem in the related art that a load pressure of a statistical center is very large in a high-concurrency multi-tenant micro-service scenario.
In a first aspect, an embodiment of the present application provides a flow control method, which is applied to a server in a service cluster, where the service cluster further includes: the system comprises a current limiting processing end and a calling end, wherein at least one calling end is distributed aiming at one server end; a server and a corresponding calling terminal form a calling chain, the method comprises:
counting the flow accumulated value of each service instance in the call chain in the current working time period, and executing the flow control operation on the service instance according to the flow accumulated value;
sending a traffic value processing request to the current limit processing end, where the traffic value processing request includes a traffic aggregate value of each service instance of the call chain in the current working time period, and the traffic value processing request is used to: requesting the flow limiting processing end to distribute a flow counteracting value for the flow totalizing value through the remaining amount of the total amount of the flow to be distributed, wherein the flow totalizing value is used for subtracting the flow counteracting value to obtain a processing result;
and executing the flow control operation of the calling chain in the next working time period according to the processing result sent by the current limiting processing end.
In an optional implementation, the performing, according to the traffic accumulation value, a traffic control operation on the service instance includes:
obtaining a traffic quota value of the call chain; the service end comprises at least one service instance, and the service instance is used for realizing the service provided by the service end;
calculating a traffic early warning value corresponding to each call chain according to the number of service instances contained in the service end, the duration of one working time period of the service instances, and traffic quota values corresponding to a plurality of call chains containing the service end, wherein the traffic early warning value is used for representing the maximum processing traffic of each service instance in the call chain;
and in the current working time period, if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain, the service end limits the traffic of the service instance.
In an optional implementation manner, the limiting the service instance when the traffic accumulated value exceeds a traffic early warning value corresponding to the call chain includes:
and when the traffic accumulated value of the service instance exceeds the traffic early warning value corresponding to the call chain, controlling the service instance to stop generating traffic in the remaining time segment in the current working time period.
In an optional implementation manner, the traffic aggregate value includes an aggregate number of access requests sent to the service instance by a calling end in the call chain, and the traffic early warning value includes: an accumulated number early warning value of the access requests;
the controlling the service instance to stop generating traffic includes:
and controlling the service instance, and stopping processing the access request sent by the calling end in the calling chain.
In an optional implementation manner, the calculating, according to the number of service instances included in the service end, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains including the service end, a traffic warning value corresponding to each of the call chains includes:
calculating the ratio of the flow quota value corresponding to the call chain to the number of the service instances;
and calculating a calculation result of the ratio and a preset coefficient, and taking the product of the calculation result and the duration as a flow early warning value of the call chain.
In an alternative implementation, the method further comprises:
obtaining a service link topology relation table from the service cluster service registration end, wherein the service link topology relation table comprises: the method comprises the following steps that the respective identifiers of a plurality of service terminals, the respective identifiers of a plurality of calling terminals, the number of service instances included by the service terminals and the calling relation between the calling terminals and the service terminals are obtained;
and determining the number of service instances included by the service end and the call chain according to the service link topology relation table.
In a second aspect, an embodiment of the present application provides a flow control method, which is applied to a flow limiting processing end in a service cluster, where the service cluster further includes: the system comprises a server and a calling end, wherein at least one calling end is distributed for one server; a server and a corresponding calling terminal form a calling chain, the method comprises:
acquiring a flow quota value set for the call chain;
calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain;
receiving a flow value processing request sent by the server; the traffic value processing request comprises a traffic accumulated value of each service instance of the call chain in the current working time period;
and distributing a flow counteracting value for the flow accumulative value in the flow value processing request according to the remaining amount of the total amount of the flow to be distributed of the call chain, wherein the flow accumulative value is used for subtracting the flow counteracting value to obtain a processing result, and the processing result is sent to the service end.
In an optional implementation manner, the calculating, according to a duration of an operating time period of the service instance of the server and a traffic quota value of the call chain, a total amount of traffic to be allocated of the call chain includes:
and taking the product of the flow quota value of the call chain and the duration of the working time period as the total flow quota to be allocated of the call chain.
In an alternative implementation, the method further comprises:
and updating the surplus limit into the total amount of the flow to be distributed in the next working time period.
In a third aspect, an embodiment of the present application provides a method for controlling a flow rate of a service cluster, which is applied to a service cluster composed of a flow limiting processing end, a service end, and a calling end; at least one calling terminal is distributed aiming at one server terminal; a server and a corresponding calling end form a calling chain, and the server comprises at least one service instance; the service instance is used for realizing the service provided by the service end; the method comprises the following steps:
the server side counts the flow accumulated value of each service instance in a call chain of the server side in the current working time period of the service instance;
the flow limiting processing terminal acquires a flow quota value set for the call chain; calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain;
the service end executes flow control operation on the service instances according to the flow accumulated value, and sends a flow value processing request to the flow limiting processing end, wherein the flow value processing request comprises the flow accumulated value of each service instance of the call chain in the current working time period;
the flow limiting processing terminal receives a flow value processing request sent by the server terminal; distributing a traffic counteracting value for a traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be distributed of the call chain, wherein the traffic accumulated value is used for subtracting the traffic counteracting value to obtain a processing result, and sending the processing result to the service end;
and the server executes the flow control operation of the calling chain in the next working time period according to the processing result sent by the current limiting processing end.
In an optional implementation manner, the performing, by the server, a flow control operation on the service instance according to the flow totalization value includes:
the server calculates a traffic early warning value corresponding to each call chain according to the number of service instances contained in the server, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains containing the server, wherein the traffic early warning value is used for representing the maximum processing traffic of each service instance in the call chain;
and in the current working time period, if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain, the service end limits the traffic of the service instance.
In an optional implementation manner, the allocating, by the current limit processing end, a traffic cancellation value to the traffic cumulative value in the traffic value processing request according to the remaining amount of the total amount of traffic to be allocated of the call chain, where the traffic cumulative value is used to subtract from the traffic cancellation value to obtain a processing result, and the allocating includes:
under the condition that the flow accumulated value in the flow value processing request is less than or equal to the remaining amount of the total amount of the flow to be distributed corresponding to the call chain, the flow limiting processing end generates a first identifier as the processing result;
and under the condition that the flow accumulated value in the flow value processing request is larger than the remaining amount of the total amount of the flow to be distributed corresponding to the call chain, the flow limiting processing end generates a second identifier as the processing result.
In an optional implementation manner, the executing, by the server, a flow control operation on the call chain in a next working time period according to a processing result sent by the current limiting processing end includes:
under the condition that the processing result comprises the first identifier, in the next working time period, the server side counts the traffic accumulated value of each service instance in the call chain, and when the traffic accumulated value exceeds the traffic early warning value corresponding to the call chain, the service instance is limited;
under the condition that the processing result comprises the second identifier, in the next working time period, the service end controls the service instance and stops processing the access request sent by the calling end in the calling chain; and before the next working time period is finished, sending a flow value repeated processing request to the current limiting processing end, wherein the flow value repeated processing request comprises: the difference between the traffic aggregate value of the service instance and the remaining amount of the total amount of traffic to be allocated, the request for repeatedly processing the traffic value is used for: requesting the flow limiting processing end to distribute a flow counteracting value for the difference value through the remaining amount of the total flow to be distributed, subtracting the flow counteracting value from the difference value to obtain a repeated processing result, and enabling the server end to execute the flow control operation on the calling chain in the next working time period.
In a fourth aspect, an embodiment of the present application provides a traffic control method and apparatus, which are applied to a server in a service cluster, where the service cluster further includes: the system comprises a current limiting processing end and a calling end, wherein at least one calling end is distributed aiming at one server end; a server and a corresponding caller form a call chain, the apparatus comprising:
the early warning module is configured to count a traffic accumulated value of each service instance in the call chain in the current working time period, and execute flow control operation on the service instance according to the traffic accumulated value;
a second traffic processing request module configured to send a traffic value processing request to the current limiting processing end, where the traffic value processing request includes a traffic accumulated value of each service instance of the call chain in the current working time period, and the traffic value processing request is used for: requesting the flow limiting processing end to distribute a flow counteracting value for the flow totalizing value through the remaining amount of the total amount of the flow to be distributed, wherein the flow totalizing value is used for subtracting the flow counteracting value to obtain a processing result;
and the second flow processing module is configured to execute the flow control operation on the call chain in the next working time period according to the processing result sent by the flow limiting processing end.
In an optional implementation, the early warning module includes:
a quota submodule configured to obtain a traffic quota value for the call chain; the service end comprises at least one service instance, and the service instance is used for realizing the service provided by the service end;
the statistical submodule is configured to calculate a traffic early warning value corresponding to each call chain according to the number of service instances included in the service end, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains including the service end, where the traffic early warning value is used for representing the maximum processing traffic of each service instance in the call chain;
and the flow limiting processing submodule is configured to limit the flow of the service instance by the service end if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain in the current working time period.
In an optional implementation, the current limit processing sub-module includes:
and the early warning unit is configured to control the service instance to stop generating the traffic in the remaining time segment in the current working time period when the traffic accumulated value of the service instance exceeds the traffic early warning value corresponding to the call chain.
In an optional implementation manner, the traffic aggregate value includes an aggregate number of access requests sent to the service instance by a calling end in the call chain, and the traffic early warning value includes: an accumulated number early warning value of the access requests;
the early warning unit includes:
and the early warning subunit is configured to control the service instance and stop processing the access request sent by the calling end in the calling chain.
In an optional implementation, the early warning value calculation module includes:
a first calculating unit configured to calculate a ratio between a traffic quota value corresponding to the call chain and the number of the service instances;
and the second calculation unit is configured to calculate a calculation result of the ratio and a preset coefficient, and take a product of the calculation result and the duration as a flow early warning value of the call chain.
In an alternative implementation, the apparatus further includes:
a second obtaining module, configured to obtain a service link topology relation table from the service cluster service registry, where the service link topology relation table includes: the method comprises the following steps that the respective identifiers of a plurality of service terminals, the respective identifiers of a plurality of calling terminals, the number of service instances included by the service terminals and the calling relation between the calling terminals and the service terminals are obtained;
and the topology module is configured to determine the number of service instances included by the service end and the call chain according to the service link topology relation table.
In a fifth aspect, an embodiment of the present application provides a flow control method and apparatus, which are applied to a flow limiting processing end in a service cluster, where the service cluster further includes: the system comprises a server and a calling end, wherein at least one calling end is distributed for one server; a server and a corresponding caller form a call chain, the apparatus comprising:
a third obtaining module configured to obtain a traffic quota value set for the call chain;
the second quota module is configured to calculate the total amount of the to-be-allocated traffic of the call chain according to the duration of one working time period of the service instance of the server and the traffic quota value of the call chain;
the receiving module is configured to receive a flow value processing request sent by the server; the traffic value processing request comprises a traffic accumulated value of each service instance of the call chain in the current working time period;
and the second traffic processing module is configured to allocate a traffic cancellation value to the traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be allocated of the call chain, wherein the traffic accumulated value is used for subtracting the traffic cancellation value to obtain a processing result, and the processing result is sent to the server.
In an optional implementation manner, the second quota module includes:
a third calculation submodule configured to take a product of the flow quota value of the call chain and the duration of the working time period as a total amount of flow to be allocated of the call chain.
In an alternative implementation, the apparatus further includes:
and the updating module is configured to update the surplus quota into the total amount of the flow to be distributed in the next working time period.
In a sixth aspect, an embodiment of the present application provides a flow control system for a service cluster, which is applied to a service cluster composed of a flow limiting processing end, a service end, and a calling end; at least one calling terminal is distributed aiming at one server terminal; a server and a corresponding calling end form a calling chain, and the server comprises at least one service instance; the service instance is used for realizing the service provided by the service end; the server side comprises: the system comprises a first statistical module, a first flow processing request module and a first current limiting operation module; the current limiting processing terminal includes: the system comprises a first quota module and a first traffic processing module;
the first statistic module is configured to count a traffic accumulated value of each service instance in a call chain of the service end in a current working time period of the service instance;
the first quota module is configured to obtain a traffic quota value set for the call chain; calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain;
the first traffic processing request module is configured to execute a traffic control operation on the service instance according to the traffic accumulated value, and send a traffic value processing request to the traffic limiting processing end, where the traffic value processing request includes a traffic accumulated value of each service instance of the call chain in the current working time period;
the first traffic processing module is configured to receive a traffic value processing request sent by the server; distributing a traffic counteracting value for a traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be distributed of the call chain, wherein the traffic accumulated value is used for subtracting the traffic counteracting value to obtain a processing result, and sending the processing result to the service end;
and the first current limiting operation module is configured to execute the flow control operation on the call chain in the next working time period according to the processing result sent by the current limiting processing end.
In an optional implementation manner, the first traffic processing request module includes:
the calculation submodule is configured to calculate, by the server, a traffic early warning value corresponding to each call chain according to the number of service instances included in the server, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains including the server, where the traffic early warning value is used to characterize the maximum processing traffic of each service instance in the call chain;
and the flow limiting submodule is configured to limit the flow of the service instance by the service end if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain in the current working time period.
In an optional implementation, the first traffic processing module includes:
the first generation submodule is configured to generate a first identifier as the processing result by the current limiting processing terminal under the condition that the traffic accumulated value in the traffic value processing request is less than or equal to the remaining amount of the total amount of traffic to be allocated corresponding to the call chain;
and the second generation submodule is configured to generate a second identifier as the processing result by the current limiting processing terminal under the condition that the traffic accumulated value in the traffic value processing request is greater than the remaining amount of the total amount of the traffic to be distributed corresponding to the call chain.
In an alternative implementation, the first current limiting operating module includes:
a first processing sub-module, configured to, if the processing result includes the first identifier, in a next working time period, the server side counts a traffic accumulated value of each service instance in the call chain, and when the traffic accumulated value exceeds a traffic early warning value corresponding to the call chain, performs current limiting on the service instance;
a second processing submodule configured to, if the processing result includes the second identifier, in a next working time period, control the service instance by the service end, and stop processing an access request sent by a calling end in the calling chain; and before the next working time period is finished, sending a flow value repeated processing request to the current limiting processing end, wherein the flow value repeated processing request comprises: the difference between the traffic aggregate value of the service instance and the remaining amount of the total amount of traffic to be allocated, the request for repeatedly processing the traffic value is used for: requesting the flow limiting processing end to distribute a flow counteracting value for the difference value through the remaining amount of the total flow to be distributed, subtracting the flow counteracting value from the difference value to obtain a repeated processing result, and enabling the server end to execute the flow control operation on the calling chain in the next working time period.
In a seventh aspect, an embodiment of the present application further provides an electronic device, including a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the traffic control method of the service cluster.
In an eighth aspect, the present application further provides a storage medium, where instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to execute the traffic control method for a service cluster.
In a ninth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for controlling flow of a service cluster is implemented.
In the embodiment of the application, the application can set the flow quota value according to the dimension of the call chain, therefore, the situation that the flow distribution is not uniform in an actual scene is considered, the method introduces the flow value processing request which is reported by the service end and comprises the flow accumulated value of the service instance to the flow limiting processing end, a mechanism for the current-limiting processing end to allocate a flow counteracting value for the flow totalizing value in the flow value processing request according to the remaining amount of the total amount of the flow to be allocated of the calling chain, and subtracting the flow counteracting value from the flow totalizing value to obtain a processing result, the processing mechanism can relieve the flow blocking condition, further optimizes the flow limiting operation, the service end can access the remote dictionary service only when the flow value reporting processing request is carried out, the flow generated in the flow value processing process is small, and excessive pressure on the load of the remote dictionary service cannot be caused.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating interaction steps of a flow control method for a service cluster according to an embodiment of the present application;
fig. 2 is a schematic system architecture diagram of a flow control method for a service cluster according to an embodiment of the present application;
fig. 3 is a flowchart illustrating steps of a method for controlling flow on a server side according to an embodiment of the present application;
fig. 4 is a flowchart illustrating steps of a flow control method on a flow-limiting processing end according to an embodiment of the present application;
fig. 5 is a block diagram of a flow control system of a service cluster according to an embodiment of the present application;
FIG. 6 is a block diagram of a flow control device on the server side according to an embodiment of the present disclosure;
fig. 7 is a block diagram of a flow control device on a side of a flow-limiting processing end according to an embodiment of the present application;
FIG. 8 is a logical block diagram of an electronic device of one embodiment of the present application;
fig. 9 is a logic block diagram of an electronic device according to another embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a flowchart of interaction steps of a flow control method for a service cluster, which is provided in an embodiment of the present application and is applied to a service cluster composed of a flow-limiting processing end, a service end, and a call end; at least one calling terminal is distributed aiming at one server terminal; a server and a corresponding calling end form a calling chain, and the server comprises at least one service instance; the service instance is used for realizing the service provided by the service end; as shown in fig. 1, the method may include:
step 101, the server side counts the traffic accumulated value of each service instance in the call chain of the server side in the current working time period of the service instance.
Referring to fig. 2, a system architecture diagram of a flow control method for a service cluster provided in an embodiment of the present application is shown, where the system architecture may specifically be a service cluster of a microservice, and the service cluster includes: the system comprises a service registration end, a current limiting processing end, a service end and a calling end; one server and one caller form one call chain.
In this embodiment, the micro service is specifically a service cluster composed of small independent services (service terminals), and these small services perform mutual communication through well-defined interfaces to cooperatively complete tasks, where the service terminals can provide services to implement corresponding partial functions, for example, an application with complex functions can be split into multiple services, each service implements its corresponding partial function based on the corresponding service terminal, and the services can communicate with each other to implement data intercommunication, so that all functions of the application are implemented through overall cooperation. Specifically, the server may include multiple service instances, where a service instance may be regarded as a mirror logic code of a service provided by the server, that is, each service instance may implement the same service, the server processes multiple access requests in parallel through the multiple service instances, and the number of the service instances may be set according to an actual scene and a requirement, which is not limited in the embodiment of the present application.
The calling end may be a user of the service, and specifically, the calling end may be a service end corresponding to an upstream service and a downstream service of the service, or may be an independent application software, or a client, and the calling end is assigned to the rented service end, so as to form a calling chain, so that the calling end may send an access request to the service end, and the service end may process the access request through a service instance included in the service end and feed back a processing result to the calling end, as shown in fig. 2, the service end 2 may have a calling end 4 and a calling end 5 corresponding thereto, so as to form two calling chains: the server 2-the calling terminal 4; server 2-caller 5.
It should be noted that multiple instances may also be established in the invoking terminal to implement the same access request processing function, for example, the invoking terminal may be an intermediate software interfacing with each client, and includes multiple instances, which is used for executing, in parallel, operations of forwarding the access request of each client to the server and sending a processing result to the client through the multiple instances. One instance of the calling end can call any one service instance of the service end, so that the traffic processing of the calling chain is realized.
The service registration end is used for registering the service provided by the service end, the service provided by the service end can be on line after the service registration end is registered, the cluster can distribute at least one calling end for one service end, the service registration end can count all the registered services and generate a service link topological relation table by combining the calling relation between the service end and the calling end, and other service ends can request to acquire the service link topological relation table from the service registration end, so that the service ends capable of communicating are determined.
In the embodiment of the present application, assuming that one working time period is 10s, for fig. 2, the server 2 may have corresponding call terminals 4 and 5, so as to form two call chains: the server 2-the calling terminal 4; in a scenario of the server 2-the call terminal 5, if the number of the service instances of the server 2 is 10, in a 10s working period, each service instance of the server 2 may respectively count a first cumulative number of access requests sent by the call terminal 4 and a second cumulative number of access requests sent by the call terminal 5, which are processed by each service instance; and using the first cumulative number as a call chain: the service end 2-the calling end 4 is used for carrying out the traffic accumulated value of the service instance; taking the second cumulative number as a call chain: the service end 2-the calling end 5 service instance flow accumulated value. The traffic accumulation value may be a total number of access requests received by the service instance, and the traffic warning value is a maximum value of a total number of access requests that the service instance may be allowed to process within one working time period.
Further, if it is counted that the first accumulated quantity exceeds the traffic early warning value, it is considered that the traffic generated when the service instance processes the access request of the invocation terminal 4 exceeds the traffic early warning value, and then the current limiting operation on the service instance may be performed, that is, the service instance is controlled to stop processing the access request of the invocation terminal 4 within the remaining time of the current working time period. In addition, if one service instance counts that the first accumulated quantity of the service instance does not exceed the flow early warning value, it is determined that no flow limiting processing is needed, and the service instance can be controlled to normally process the access request of the calling terminal 4. The same applies to the determination of the second cumulative amount. In the step, the logic judgment of the current limiting operation can be executed through the reasonable and accurate flow early warning values of each service instance, so that the current limiting operation can be suitable for high-concurrency, multi-service and multi-tenant scenes, and the current limiting error in the scene of uneven flow distribution is reduced.
102, a flow limit processing end obtains a flow quota value set for the call chain; and calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain.
In this step, the flow of the call chain may refer to the access request processed by the call chain, and the throttling is to limit the capability of the call chain to process the access request. Thus, current limiting requires an index to provide a threshold reference so that a service instance can refer to the index to determine whether it needs to be current limited.
Specifically, the index may include a traffic quota value set for the call chain, where the traffic quota value may reflect an upper limit of a capability of a server in the call chain to process an access request, and in an implementation, the traffic quota value may be a Query Per Second (QPS), where QPS is a query number that can be responded Per Second, and is a measure of how much traffic is processed by a specific server in a specified time, and a query number that is responded may be regarded as processing an access request.
Referring to fig. 2, in practical application, a plurality of machine rooms are divided according to requirements of practical situations, and a server and a calling end corresponding to the server can be deployed in different machine rooms, for example, in practical situations, the east China and south China have different requirements for different services, and different services have different input flows, which causes the phenomenon of uneven flow of the whole cluster, so that different machine rooms can be divided for different areas, and the server and the calling end corresponding to the service required by the area are deployed in the machine room corresponding to the area, referring to fig. 2, assuming that the machine room a corresponds to the east China, the service provided by the east China requires the server 1 and the server 2, the machine room B corresponds to the south China, and the service provided by the south China requires the server n, the server 1, the server 2 and the calling end corresponding to the machine room a can be deployed in the machine room a, deploying the server n and the corresponding calling end in the machine room B, wherein the machine room A has corresponding first user inlet total flow due to different regions and services; machine room B has a corresponding total second user inlet flow.
When the flow quota value is set for the call chain of the machine room a, the flow quota value meeting the characteristic requirement of each call chain can be set for each call chain with reference to the total flow of the first user inlet of the machine room a and the respective characteristics (such as the service characteristic of the service end and the requirement characteristic of the call end) of the three call chains in the machine room a.
In this embodiment of the present application, the total amount of traffic to be allocated corresponding to the call chain may be a product of a traffic quota value corresponding to the call chain and a duration of the working time period, that is, a result of the product represents an upper limit of traffic commonly used by all service instances in the call chain. And the current limiting processing terminal can calculate the total amount of the flow to be distributed of each call chain according to the acquired flow quota value of each call chain and the duration of the working time period.
103, the service end executes the flow control operation on the service instance according to the flow accumulated value, and sends a flow value processing request to the flow limiting processing end, where the flow value processing request includes the flow accumulated value of each service instance of the call chain in the current working time period.
In the related art, the flow limiting process is to count the traffic accumulated value of the service instance in the current working period, perform flow limiting when the traffic accumulated value is too high, and when the next working period starts, remove the flow limiting, then count the traffic accumulated value of the service instance again and perform processing according to the flow limiting logic. Due to the fact that flow distribution is not uniform in an actual scene, if an emergency causes that the flow accumulated value in the current working time period is too large and far exceeds a threshold value, in the next working time period, flow limitation is relieved firstly and new flow begins to be received, and due to the fact that a large amount of flow is accumulated in the previous working time period and the new flow is combined, the load of a service instance far exceeds a specified load, the flow in the service instance is blocked, namely the redundant flow is not discharged in the current limiting operation in the previous working time period, and a large amount of new flow is accumulated in the next working time period, so that service performance is unstable, and processing efficiency is reduced.
According to the embodiment of the application, the traffic accumulated value of each service instance in the call chain is counted during the working period, the service instance is limited when the traffic accumulated value is too high, and a flow limiting processing end can be introduced to perform further flow limiting optimization processing, so that the problem of traffic jam is solved.
Specifically, the flow limiting processing end may communicate with each service instance, obtain a traffic quota value of each call chain, and calculate a total amount of traffic to be allocated corresponding to each call chain according to the traffic quota value and a duration of a working time period, and the flow limiting processing end may specifically be a remote dictionary service, is an open-source support network, may be based on a memory, and may also be a persistent log-type, key-value pair format database, and provides an interface of multiple languages. In one case, the total amount of traffic to be allocated corresponding to the call chain may be a product of a traffic quota value corresponding to the call chain and a duration of the working time period, that is, a result of the product represents an upper limit of traffic commonly used by all service instances in the call chain.
Optionally, step 103 may specifically include:
and a substep 1031, calculating, by the server, a traffic early warning value corresponding to each call chain according to the number of service instances included in the server, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains including the server, where the traffic early warning value is used to represent the maximum processing traffic of each service instance in the call chain.
In the embodiment of the present application, the service instance may execute a work cycle according to the divided work time periods, and enter the work of the next work time period after the current work time period ends, so that the current limiting operation may also be performed according to the division of the work time periods.
Since the traffic quota value of the call chain may represent the upper limit of the traffic allocated to the call chain, in one case, the ratio of the traffic quota value to the number of service instances may be calculated based on the number of service instances included in the service end in the call chain, and the product of the ratio and the duration of one working time period of the service instances is determined as the traffic early warning value corresponding to the call chain, where the traffic early warning value is used to characterize the maximum processing traffic of each service instance in the call chain, and the maximum processing traffic is the maximum processable traffic of the service instance, that is, the traffic quota value is the upper limit of the traffic allowed to be carried by a single service instance of the service end when the call end in the call chain is docked.
For example, as shown in fig. 2, the server 2 may have corresponding call terminals 4 and 5, thereby forming two call chains: the server 2-the calling terminal 4; the server 2-calling end 5; assume that to call the chain: the flow quota value distributed by the server 2-the calling terminal 4 is 20; to call the chain: the flow quota value allocated by the server 2-the call terminal 5 is 30, and the server 2 includes 10 service instances, and the duration of one working time period of a service instance is 10s, then the call chain: the traffic early warning value of a single service instance in the server 2-the call terminal 4 may be (20/10) × 10 ═ 20, that is, for the call terminal 4, the traffic early warning value of a single service instance in the server 2 is 20; calling a chain: the traffic warning value of a single service instance in the server 2-the caller 5 may be (30/10) × 10 ═ 30, that is, for the caller 5, the traffic warning value of a single service instance in the server 2 may be 30.
In the related art, the traffic early warning value of a single service instance at a server in a service cluster is determined, and only the ratio of the total traffic quota value set for the entire service cluster to the number of all service instances contained in the entire service cluster is determined as the traffic early warning value of the single service instance, which may cause that the traffic early warning value of the single service instance in the related art does not consider the situation of uneven traffic distribution existing in an actual scene, so that the traffic early warning value is too even, and an error occurs in the flow limiting operation of some service instances.
In the embodiment of the present application, the traffic quota value may be set by using the dimension of the call chain based on the condition of uneven traffic distribution existing in the actual scene, and when the traffic quota value is set, the traffic characteristics of the machine room where the call chain is located and the traffic characteristics of the call end in the call chain are fully considered, so that the traffic quota value is more suitable for the dimension of the call chain, and thus when the traffic early warning value of a single service instance in the call chain is subsequently calculated, the available traffic early warning value of the service instance also takes the condition of uneven traffic distribution in the actual scene into consideration, and a more accurate traffic early warning value of the single service instance can be obtained.
And a substep 1032 of limiting the flow of the service instance by the service end if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain in the current working time period.
In this embodiment of the present application, the flow limiting operation may specifically control the service instance to stop generating the flow in the remaining time segment in the current working time period when the traffic accumulated value of the service instance exceeds the traffic early warning value corresponding to the call chain, so that the service instance is in an idle state in the remaining time segment, thereby preventing the traffic of the service instance from continuing to increase, and achieving the purpose of limiting the flow.
104, receiving a flow value processing request sent by the server by a flow limiting processing end; and distributing a flow counteracting value for the flow accumulative value in the flow value processing request according to the remaining amount of the total amount of the flow to be distributed of the calling chain, wherein the flow accumulative value is used for subtracting the flow counteracting value to obtain a processing result, and the processing result is sent to the service end.
Further, the service end may send a traffic value processing request to the current limiting processing end at the end of each working time period, where the traffic value processing request includes a traffic accumulated value of each service instance of the call chain in the working time period, and since the current limiting processing end has a total amount of traffic to be allocated of each call chain, the current limiting processing end may process the traffic accumulated value of each service instance of the call chain in the traffic value processing request in a form of reimbursement according to a remaining amount of the total amount of traffic to be allocated of the call chain, so as to obtain a processing result and send the processing result to the corresponding service instance, so that the service instance performs a flow control operation in a next working time period according to the processing result. The traffic cumulative value in the traffic value processing request is processed in a reimbursement mode, specifically, a traffic cancellation value can be allocated to the traffic cumulative value in the traffic value processing request by the traffic limiting processing end according to the remaining amount of the total amount of traffic to be allocated of the call chain, and the traffic cumulative value is subtracted from the traffic cancellation value to obtain a processing result.
Wherein, if the remaining quota of the total amount of traffic to be distributed of the call chain can completely offset the traffic accumulated value of the service instance, then it is determined that no traffic jam is currently generated, and returns a message of successful processing to the service instance, so that the service instance can normally process the access request in the next working period, if the remaining quota of the total amount of traffic to be allocated of the call chain cannot completely offset the traffic accumulated value of the service instance, it is assumed that traffic congestion is currently generated and information of processing failure is returned to the service instance, so that the service instance can stop processing access requests for the next working period, and continue to request the current-limiting processing end to process the part which is not counteracted at the end of the next working time period until the processing is successful, the traffic congestion may be considered to have cleared and the access request may be processed normally for a later period of operation. Through the mode, the flow blockage state can be effectively identified, the problem of flow blockage is solved, and long-time blockage of flow under the condition of non-uniform flow distribution is avoided.
Specifically, in the embodiment of the present application, since the flow limit processing end has the total amount of the traffic to be allocated of each call chain, the flow limit processing end may cancel the traffic accumulated value of each service instance of the call chain in the flow value processing request according to the remaining amount of the total amount of the traffic to be allocated of the call chain, so as to obtain the processing result and send the processing result to the corresponding service instance, so that the service instance performs the flow control operation in the next working time period according to the processing result.
Optionally, the method further includes: and updating the surplus limit into the total amount of the flow to be distributed in the next working time period. Because the total amount of the flow to be distributed is set for one working time period, the flow limiting processing end updates the remaining amount of the total amount of the flow to be distributed into the total amount of the flow to be distributed when a new working time period starts so as to carry out flow counteracting operation of the new working time period.
For example, referring to fig. 2, the server 2 has a corresponding caller 4;
assume that the quota of call chain 2-4 is 30; the service end 2 has 10 service instances, the duration of one working time period of the service instance is 10s, the total amount of traffic to be allocated is 300 for the calling chain 2-4, and in addition, the traffic early warning value of a single service instance in the calling chain 2-4 is ((30/10) × 1.5+10) × 10 ═ 145.
In a working time period, if the traffic integrated value of one service instance in the call chain 2-4 reaches the traffic early warning value 145 at the fifth second, the service instance is limited at the fifth second to the tenth second of the working time period, the processing of the service instance on the access request sent by the call terminal 4 is stopped, and at the tenth second, a traffic value processing request containing the traffic integrated value 145 is sent to the flow limiting processing terminal, and the flow limiting processing terminal cancels the traffic integrated value according to the current remaining quota of the total amount of traffic to be distributed 300.
If the remaining amount is 200, 145 of the remaining amount may be taken out to process the flow value processing request, so that the remaining amount after cancellation is 55, and the feedback information with content of 0 is sent to the service instance after cancellation, so that the service instance normally calls the processing access request sent by the terminal 4 in the next working time period, and processes according to the flow limiting logic; in addition, if the remaining amount is 10, it can be determined that a large amount of traffic flows into the service instance and a traffic jam occurs, 145 to be cancelled in the traffic value processing request cannot be processed completely, only 10 of the traffic values can be cancelled, and the remaining 135 un-cancelled amount after partial cancellation is sent to the service instance.
It should be noted that in some scenarios, a small traffic quota value may be configured for the call chain, which causes the traffic warning value calculated by a single service instance to be very small, and in the related art, the current limitation may be generated in such a situation, which causes a phenomenon of false current limitation. The embodiment of the application can be suitable for the scene, and the probability of the phenomenon of mistaken current limiting is reduced.
Specifically, it is assumed that the server a has 100 service instances, a flow quota value is set to be a smaller value 1 for a call chain of the server a-the call terminal 1, and the duration of one working period is 10 s.
In the related art, a token throttling manner is adopted, a traffic early warning value of a single service instance is (1/100) × 10 is 0.1, throttling is directly generated at the beginning of a working time period, and throttling can be released after 10 working time periods are waited, so that an access request is allowed to pass, and thus a token index of one access request can be met only by accumulating 10 working time periods, and an access request jam phenomenon occurs.
In the embodiment of the present application, it is assumed that the duration of one working time period is 10s, the traffic warning value of a single service instance is (1/100) × 10 ═ 0.1, and the total amount of traffic to be allocated corresponding to the call chain is 10 × 1 ═ 10. In a working time period, the embodiment of the application allows a service instance to process an access request of a calling end 1, a remaining time segment performs current limiting of the service instance for the calling end 1, and sends a traffic value processing request of 1 access request to the current limiting processing end, if a remaining quota of a total amount of traffic to be allocated by the current limiting processing end for the calling end 1 is 10, a quota of 9 is offset, and processing success information is returned to the service instance, so that the service instance continues the flow in the next working time period, and the whole process does not need to wait for too long time to pass through an access request, and the phenomenon of request blocking is not caused.
Optionally, step 104 may specifically include:
in sub-step 1041, when the traffic accumulated value in the traffic value processing request is less than or equal to the remaining amount of the total amount of traffic to be allocated corresponding to the call chain, the current limit processing end generates a first identifier as the processing result.
And in the substep 1042, when the traffic cumulative value in the traffic value processing request is greater than the remaining quota of the total amount of traffic to be allocated corresponding to the call chain, the current limit processing end generates a second identifier as the processing result.
In this embodiment of the present application, when receiving a flow value processing request, the flow limit processing end may cancel the flow cumulative value of the service instance in the flow value processing request according to the remaining amount of the total amount of the flow to be allocated corresponding to the call chain, which may have two processing results: 1. the remaining quota of the total amount of the traffic to be allocated is enough to completely offset the traffic accumulated value, and at this time, the first identifier may be 0, that is, it is reflected that the remaining amount to be offset is 0, and the processing is successful. 2. The remaining quota of the total amount of traffic to be allocated is not enough to completely offset the traffic cumulative value, and at this time, the second identifier may be a difference between the traffic cumulative value of the service instance and the remaining quota of the total amount of traffic to be allocated, that is, the remaining amount to be offset is reflected as the difference, and the processing is not completed.
And 105, the server executes the flow control operation on the call chain in the next working time period according to the processing result sent by the flow limiting processing end.
In the embodiment of the present application, if the remaining quota of the total amount of traffic to be allocated is enough to completely offset the traffic accumulated value, it is reflected that the traffic processing request sent by the current limiting processing end to the server is successfully processed. The service instance is considered to have all the traffic accumulated values cancelled, and at this time, no traffic jam caused by uneven traffic distribution exists, so that the service instance can not execute flow limitation at the beginning of the next working time period and normally process the access request sent by the calling end.
If the remaining amount of the total amount of the traffic to be distributed is not enough to completely offset the traffic accumulated value, it is reflected that the traffic processing request sent by the current limiting processing end to the service end is not processed. Considering that the traffic accumulated value of the service instance is not completely cancelled, at this time, traffic jam caused by uneven traffic distribution may exist, so that the service instance may continue to perform flow limitation at the beginning of the next working time period, and when the next working time period ends, send a repeated traffic value processing request to the flow limitation processing end to continue processing the flow that is not cancelled, until all the traffic is cancelled, then remove the flow limitation.
Optionally, step 105 may specifically include:
sub-step 1051, if the processing result includes the first identifier, then in the next working time period, the server side counts the traffic accumulated value of each service instance in the call chain, and when the traffic accumulated value exceeds the traffic early warning value corresponding to the call chain, the server side performs flow limitation on the service instance.
Substep 1052, in case that the processing result includes the second identifier, in a next working time period, the server controls the service instance to stop processing the access request sent by the calling end in the calling chain; and sending a flow value repeated processing request to the current limiting processing end before the next working time period is finished.
Wherein, the flow value repeat processing request comprises: the difference between the traffic aggregate value of the service instance and the remaining amount of the total amount of traffic to be allocated, the request for repeatedly processing the traffic value is used for: requesting the flow limiting processing end to distribute a flow counteracting value for the difference value through the remaining amount of the total flow to be distributed, subtracting the flow counteracting value from the difference value to obtain a repeated processing result, and enabling the server end to execute the flow control operation on the calling chain in the next working time period.
Specifically, when receiving the traffic value processing request, the current limit processing end may process the traffic integrated value of the service instance in the traffic value processing request according to the remaining amount of the total amount of traffic to be allocated corresponding to the call chain, which may have two processing results: 1. the remaining quota of the total amount of the traffic to be allocated is enough to completely offset the traffic accumulated value, and at this time, the first identifier may be 0, that is, it is reflected that the remaining amount to be offset is 0, and the processing is successful. 2. The remaining quota of the total amount of traffic to be allocated is not enough to completely offset the traffic cumulative value, and at this time, the second identifier may be a difference between the traffic cumulative value of the service instance and the remaining quota of the total amount of traffic to be allocated, that is, the remaining amount to be offset is reflected as the difference, and the processing is not completed.
And when the next working time period is over, sending a repeated flow value processing request to the flow limiting processing end to continue processing the flow which is not counteracted until all the flow is counteracted, and then removing the flow limitation.
To sum up, in the flow control method of a service cluster provided in the embodiment of the present application, a mechanism is introduced in which a server reports a flow value processing request including a flow integrated value of a service instance to a current limiting processing end, so that the current limiting processing end allocates a flow cancellation value to the flow integrated value in the flow value processing request according to a remaining amount of a total amount of traffic to be allocated of a call chain, and the flow integrated value is subtracted from the flow cancellation value to obtain a processing result.
Fig. 3 is a flowchart of steps of a flow control method provided in an embodiment of the present application, where the flow control method is applied to a server in a service cluster, where the service cluster further includes: the system comprises a current limiting processing end and a calling end, wherein at least one calling end is distributed aiming at one server end; as shown in fig. 3, the method may include:
step 201, in the current working time period, counting the traffic accumulated value of each service instance in the call chain, and executing the traffic control operation on the service instance according to the traffic accumulated value.
This step may specifically refer to step 103, which is not described herein again.
Optionally, step 201 may specifically include:
substep 2011, obtaining a flow quota value for the call chain; the service end comprises at least one service instance, and the service instance is used for realizing the service provided by the service end.
In this step, the flow of the call chain may refer to the access request processed by the call chain, and the throttling is to limit the capability of the call chain to process the access request. Thus, current limiting requires an index to provide a threshold reference so that a service instance can refer to the index to determine whether it needs to be current limited.
Substep 2012, calculating a traffic early warning value corresponding to each call chain according to the number of service instances included in the service end, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains including the service end, where the traffic early warning value is used to characterize the maximum processing traffic of each service instance in the call chain.
In the embodiment of the present application, the service instance may execute a work cycle according to the divided work time periods, and enter the work of the next work time period after the current work time period ends, so that the current limiting operation may also be performed according to the division of the work time periods.
Since the traffic quota value of the call chain may represent the upper limit of the traffic allocated to the call chain, in one case, the ratio of the traffic quota value to the number of service instances may be calculated based on the number of service instances included in the service end in the call chain, and the product of the ratio and the duration of one working time period of the service instance is determined as the traffic early warning value corresponding to the call chain, that is, the traffic quota value is the upper limit of the traffic allowed to be carried by a single service instance of the service end when the call end in the call chain is docked.
Optionally, sub-step 2012 may specifically include:
sub-step 20121, calculating the ratio between the traffic quota value corresponding to the call chain and the number of the service instances.
And a substep 20122 of calculating a calculation result of the ratio and a preset coefficient, and taking a product of the calculation result and the duration as a traffic early warning value of the call chain.
It should be noted that, when determining the traffic early warning value of the service instance, a reserved buffer (buffer) is also considered, based on the number of service instances included in the service end in the call chain, a ratio between the traffic quota value and the number of service instances may be calculated first, and then the ratio, a preset coefficient and a duration are calculated to obtain the traffic early warning value, the calculation with the preset coefficient may include multiplying the ratio by a tolerable traffic ramp coefficient, and finally adding a fixed coefficient to the product to obtain the traffic early warning value corresponding to the call chain, where in the case that one duty cycle of the service instance is 10s, the tolerable traffic ramp coefficient may be 1.5, and the fixed coefficient may be 10.
And a substep 2013, when the traffic accumulated value of the service instance exceeds the traffic early warning value corresponding to the call chain, controlling the service instance to stop generating traffic in the remaining time segment in the current working time period.
In this embodiment of the present application, the flow limiting operation may specifically control the service instance to stop generating the flow in the remaining time segment in the current working time period when the traffic accumulated value of the service instance exceeds the traffic early warning value corresponding to the call chain, so that the service instance is in an idle state in the remaining time segment, thereby preventing the traffic of the service instance from continuing to increase, and achieving the purpose of limiting the flow.
Optionally, the traffic accumulated value includes an accumulated number of access requests sent to the service instance by a calling end in the call chain, and the traffic early warning value includes: an accumulated number early warning value of the access requests; the sub-step 2013 may further stop processing the access request sent by the calling end in the call chain by controlling the service instance.
In this embodiment of the present application, the flow of the call chain may refer to an access request processed by the call chain, and the throttling is to limit the capability of the call chain to process the access request, specifically, the throttling action occurs at the server, and when the access request processed by the service instance of the server exceeds the support of the computing resource of the service instance, the server may throttle the service instance and prevent the service instance from continuously processing a new access request.
For example, if the duration of one working time period is 10s, when the traffic accumulated value of one service instance reaches the traffic warning value at the fifth second, the service instance is limited in the fifth to tenth seconds of the working time period, and the processing of the access request sent by the calling terminal 4 is stopped.
Step 202, sending a traffic value processing request to the current limiting processing end, where the traffic value processing request includes a traffic integrated value of each service instance of the call chain in the current working time period, and the traffic value processing request is used to: requesting the flow limiting processing end to distribute a flow counteracting value for the flow totalizing value through the remaining amount of the total amount of the flow to be distributed, wherein the flow totalizing value is used for subtracting the flow counteracting value to obtain a processing result.
This step may specifically refer to step 103, which is not described herein again.
And 203, executing the flow control operation on the call chain in the next working time period according to the processing result sent by the current limiting processing end.
The step may specifically refer to the step 105, and is not described herein again.
Optionally, the method further includes:
step 204, obtaining a service link topology relation table from the service cluster service registration end, where the service link topology relation table includes: the method comprises the steps of identifying the identifiers of a plurality of service terminals, the identifiers of a plurality of calling terminals, the number of service instances included by the service terminals and the calling relationship between the calling terminals and the service terminals.
In the embodiment of the application, because the service architecture of the micro-service is provided with the service registration end, the service registration end is used for registering the service provided by the service end, the service provided by the service end can be on line after the service registration end is registered, the cluster can allocate at least one calling end for one service end, the service registration end can count all registered services, and generate the service link topology relation table by combining the calling relation between the service end and the calling end, other service ends can acquire the service link topology relation table from the service registration end, so that the service ends capable of communicating can be determined, and each service end can acquire the service link topology relation table, so that the service ends, the calling ends and the calling relation between the service ends and the calling end in the whole service cluster can be known.
Step 205, determining the number of service instances included in the service end and the call chain according to the service link topology relation table.
In the embodiment of the application, based on the service link topology relation table, each service end can determine the number of the service instances contained in the service end and the number of the call ends allocated to the service end, so that the call chain associated with the service end is determined.
To sum up, the flow control method provided in the embodiment of the present application may set the flow quota value according to the dimension of the call chain, so as to consider the situation of uneven flow distribution in the actual scene, and when calculating the flow early warning value of a single service instance in the call chain in the subsequent process, obtain a more accurate flow early warning value of the single service instance, so that when limiting the flow of the service instance according to the flow early warning value, a more accurate flow limiting effect can be achieved, and a flow limiting error is reduced, and the flow limiting operation may be performed locally, without accessing a remote dictionary service at a remote end, reducing the load pressure of the remote dictionary service, and finally, a flow processing mechanism is introduced to alleviate the flow blockage situation, further optimizing the flow limiting operation, and the service end only accesses the remote dictionary service when performing flow processing, the traffic generated by traffic processing is small, and excessive pressure on the load of the remote dictionary service is avoided.
Fig. 4 is a flowchart of steps of a flow control method provided in an embodiment of the present application, where the flow control method is applied to a flow limiting processing end in a service cluster, where the service cluster further includes: the system comprises a server and a calling end, wherein at least one calling end is distributed for one server; as shown in fig. 4, the method may include:
and 301, acquiring a flow quota value set for the call chain.
This step may specifically refer to step 102, which is not described herein again.
Step 302, calculating a total amount of traffic to be allocated of the call chain according to the duration of one working time period of the service instance of the service end and the traffic allocation value of the call chain.
This step may specifically refer to step 102, which is not described herein again.
Optionally, step 302 may specifically include:
substep 3021, taking the product of the traffic quota value of the call chain and the duration of the operating time period as the total amount of traffic to be allocated of the call chain.
In this embodiment of the present application, the total amount of traffic to be allocated corresponding to the call chain may be a product of a traffic quota value corresponding to the call chain and a duration of the working time period, that is, a result of the product represents an upper limit of traffic commonly used by all service instances in the call chain. And the current limiting processing terminal can calculate the total amount of the flow to be distributed of each call chain according to the acquired flow quota value of each call chain and the duration of the working time period.
Step 303, receiving a flow value processing request sent by the server; the traffic value processing request comprises a traffic aggregate value of each service instance of the call chain in the current working period.
This step may specifically refer to step 104, which is not described herein again.
And 304, distributing a traffic counteracting value to a traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be distributed of the call chain, wherein the traffic accumulated value is used for subtracting the traffic counteracting value to obtain a processing result, and sending the processing result to the service end.
This step may specifically refer to step 104, which is not described herein again.
Optionally, the method further includes:
step 305, in the next working time period, updating the surplus limit to the total amount of the flow to be distributed.
Because the total amount of the flow to be distributed is set for one working time period, when a new working time period starts, the flow limiting processing end updates the remaining amount of the total amount of the flow to be distributed into the total amount of the flow to be distributed so as to carry out processing operation of the new working time period.
To sum up, the flow control method provided in the embodiment of the present application may set the flow quota value according to the dimension of the call chain, so as to consider the situation of uneven flow distribution in the actual scene, and when calculating the flow early warning value of a single service instance in the call chain in the subsequent process, obtain a more accurate flow early warning value of the single service instance, so that when limiting the flow of the service instance according to the flow early warning value, a more accurate flow limiting effect can be achieved, and a flow limiting error is reduced, and the flow limiting operation may be performed locally, without accessing a remote dictionary service at a remote end, reducing the load pressure of the remote dictionary service, and finally, a flow processing mechanism is introduced to alleviate the flow blockage situation, further optimizing the flow limiting operation, and the service end only accesses the remote dictionary service when performing flow processing, the traffic generated by traffic processing is small, and excessive pressure on the load of the remote dictionary service is avoided.
Fig. 5 is a block diagram of a flow control system of a service cluster according to an embodiment of the present application, which is applied to a service cluster formed by a flow limiting processing end 40, a service end 50, and a calling end 60; at least one calling terminal 60 is allocated to one server terminal 50; a server 50 and a corresponding calling terminal 60 form a calling chain, and the server 50 comprises at least one service instance; the service instance is used for realizing the service provided by the service end; the server 50 includes: a first statistical module 51, a first flow processing request module 52, a first current limiting operation module 53; the current limiting processing terminal 40 includes: a first quota module 41 and a first traffic processing module 42;
the first statistical module 51 is configured to, during a current working time period of a service instance, count a traffic cumulative value of each service instance in a call chain including the service end;
the first quota module 41 is configured to obtain a traffic quota value set for the call chain; calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain;
the first traffic processing request module 52 is configured to perform a traffic control operation on the service instance according to the traffic cumulative value, and send a traffic value processing request to the current limiting processing end, where the traffic value processing request includes a traffic cumulative value of each service instance of the call chain in the current working time period;
the first traffic processing module 42 is configured to receive a traffic value processing request sent by the server; distributing a traffic counteracting value for a traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be distributed of the call chain, wherein the traffic accumulated value is used for subtracting the traffic counteracting value to obtain a processing result, and sending the processing result to the service end;
the first current limiting operation module 53 is configured to execute a flow control operation on the call chain in a next working time period according to a processing result sent by the current limiting processing terminal.
In an optional implementation manner, the first traffic processing request module includes:
the calculation submodule is configured to calculate, by the server, a traffic early warning value corresponding to each call chain according to the number of service instances included in the server, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains including the server, where the traffic early warning value is used to characterize the maximum processing traffic of each service instance in the call chain;
and the flow limiting submodule is configured to limit the flow of the service instance by the service end if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain in the current working time period.
In an optional implementation, the first traffic processing module includes:
the first generation submodule is configured to generate a first identifier as the processing result by the current limiting processing terminal under the condition that the traffic accumulated value in the traffic value processing request is less than or equal to the remaining amount of the total amount of traffic to be allocated corresponding to the call chain;
and the second generation submodule is configured to generate a second identifier as the processing result by the current limiting processing terminal under the condition that the traffic accumulated value in the traffic value processing request is greater than the remaining amount of the total amount of the traffic to be distributed corresponding to the call chain.
In an alternative implementation, the first current limiting operating module includes:
a first processing sub-module, configured to, if the processing result includes the first identifier, in a next working time period, the server side counts a traffic accumulated value of each service instance in the call chain, and when the traffic accumulated value exceeds a traffic early warning value corresponding to the call chain, performs current limiting on the service instance;
a second processing submodule configured to, if the processing result includes the second identifier, in a next working time period, control the service instance by the service end, and stop processing an access request sent by a calling end in the calling chain; and before the next working time period is finished, sending a flow value repeated processing request to the current limiting processing end, wherein the flow value repeated processing request comprises: the difference between the traffic aggregate value of the service instance and the remaining amount of the total amount of traffic to be allocated, the request for repeatedly processing the traffic value is used for: requesting the flow limiting processing end to distribute a flow counteracting value for the difference value through the remaining amount of the total flow to be distributed, subtracting the flow counteracting value from the difference value to obtain a repeated processing result, and enabling the server end to execute the flow control operation on the calling chain in the next working time period.
To sum up, the flow control device of a service cluster provided in the embodiments of the present application may set a flow quota value according to a dimension of a call chain, so as to consider a situation that flow distribution is not uniform in an actual scene, and obtain a more accurate flow early warning value of a single service instance when subsequently calculating a flow early warning value of the single service instance in the call chain, so that when limiting a flow to the service instance according to the flow early warning value, a more accurate current limiting effect can be achieved, a current limiting error is reduced, the current limiting operation may be performed locally, a remote dictionary service is not required to be accessed, a load pressure of the remote dictionary service is reduced, and finally, a flow processing mechanism is introduced to alleviate a flow blocking situation, a current limiting operation is further optimized, and a service end only accesses the remote dictionary service when performing flow processing, the traffic generated by traffic processing is small, and excessive pressure on the load of the remote dictionary service is avoided.
Fig. 6 is a block diagram of a flow control device provided in an embodiment of the present application, where the flow control device is applied to a server in a service cluster, where the service cluster further includes: the system comprises a current limiting processing end and a calling end, wherein at least one calling end is distributed aiming at one server end; a server and a corresponding caller form a call chain, the apparatus comprising: a first acquisition module 801, an early warning value calculation module 802, an early warning module 803, a second traffic processing request module 804, and a second traffic processing module 805.
The early warning module 801 is configured to count a traffic accumulated value of each service instance in the call chain in the current working time period, and execute a traffic control operation on the service instance according to the traffic accumulated value;
a second traffic processing request module 802, configured to send a traffic value processing request to the current limit processing end, where the traffic value processing request includes a traffic accumulated value of each service instance of the call chain in the current working time period, and the traffic value processing request is used for: requesting the flow limiting processing end to distribute a flow counteracting value for the flow totalizing value through the remaining amount of the total amount of the flow to be distributed, wherein the flow totalizing value is used for subtracting the flow counteracting value to obtain a processing result;
a second traffic processing module 803, configured to execute a traffic control operation on the call chain for a next working time period according to the processing result sent by the current limiting processing end.
In an optional implementation, the early warning module includes:
a quota submodule configured to obtain a traffic quota value for the call chain; the service end comprises at least one service instance, and the service instance is used for realizing the service provided by the service end;
the statistical submodule is configured to calculate a traffic early warning value corresponding to each call chain according to the number of service instances included in the service end, the duration of one working time period of the service instances, and traffic quota values corresponding to each of a plurality of call chains including the service end, where the traffic early warning value is used for representing the maximum processing traffic of each service instance in the call chain;
and the flow limiting processing submodule is configured to limit the flow of the service instance by the service end if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain in the current working time period.
In an optional implementation, the current limit processing sub-module includes:
and the early warning unit is configured to control the service instance to stop generating the traffic in the remaining time segment in the current working time period when the traffic accumulated value of the service instance exceeds the traffic early warning value corresponding to the call chain.
In an optional implementation manner, the traffic aggregate value includes an aggregate number of access requests sent to the service instance by a calling end in the call chain, and the traffic early warning value includes: an accumulated number early warning value of the access requests;
the early warning unit includes:
and the early warning subunit is configured to control the service instance and stop processing the access request sent by the calling end in the calling chain.
In an alternative implementation, the statistics submodule includes:
a first calculating subunit, configured to calculate a ratio between a traffic quota value corresponding to the call chain and the number of the service instances;
and the second calculating subunit is configured to calculate a calculation result of the ratio and a preset coefficient, and take a product of the calculation result and the duration as a traffic early warning value of the call chain.
In an alternative implementation, the apparatus further includes:
a second obtaining module, configured to obtain a service link topology relation table from the service cluster service registry, where the service link topology relation table includes: the method comprises the following steps that the respective identifiers of a plurality of service terminals, the respective identifiers of a plurality of calling terminals, the number of service instances included by the service terminals and the calling relation between the calling terminals and the service terminals are obtained;
and the topology module is configured to determine the number of service instances included by the service end and the call chain according to the service link topology relation table.
To sum up, the flow control device provided in the embodiments of the present application may set the flow quota value according to the dimension of the call chain, so as to consider the situation of uneven flow distribution in the actual scene, and when calculating the flow early warning value of a single service instance in the call chain in the subsequent process, obtain a more accurate flow early warning value of the single service instance, so that when limiting the flow of the service instance according to the flow early warning value, a more accurate flow limiting effect can be achieved, and a flow limiting error is reduced, and the flow limiting operation may be performed locally, without accessing a remote dictionary service at a remote end, reducing the load pressure of the remote dictionary service, and finally, a flow processing mechanism is introduced to alleviate the flow blockage situation, further optimizing the flow limiting operation, and the service end only accesses the remote dictionary service when performing flow processing, the traffic generated by traffic processing is small, and excessive pressure on the load of the remote dictionary service is avoided.
Fig. 7 is a block diagram of a flow control device provided in an embodiment of the present application, where the flow control device is applied to a flow limiting processing end in a service cluster, where the service cluster further includes: the system comprises a server and a calling end, wherein at least one calling end is distributed for one server; a server and a corresponding caller form a call chain, the apparatus comprising: a third obtaining module 901, a second quota module 902, a receiving module 903, and a second traffic processing module 904.
A third obtaining module 901 configured to obtain a traffic quota value set for the call chain;
a second quota module 902, configured to calculate a total amount of traffic to be allocated of the call chain according to a duration of one working time period of the service instance of the server and a traffic quota value of the call chain;
a receiving module 903, configured to receive a flow value processing request sent by the server; the traffic value processing request comprises a traffic accumulated value of each service instance of the call chain in the current working time period;
and a second traffic processing module 904, configured to allocate a traffic cancellation value to a traffic cumulative value in the traffic value processing request according to a remaining amount of the total amount of traffic to be allocated of the call chain, where the traffic cumulative value is used for subtracting the traffic cancellation value to obtain a processing result, and send the processing result to the server.
In an optional implementation manner, the second quota module includes:
a third calculation submodule configured to take a product of the flow quota value of the call chain and the duration of the working time period as a total amount of flow to be allocated of the call chain.
In an alternative implementation, the apparatus further includes:
and the updating module is configured to update the surplus quota into the total amount of the flow to be distributed in the next working time period.
To sum up, the flow control device provided in the embodiments of the present application may set the flow quota value according to the dimension of the call chain, so as to consider the situation of uneven flow distribution in the actual scene, and when calculating the flow early warning value of a single service instance in the call chain in the subsequent process, obtain a more accurate flow early warning value of the single service instance, so that when limiting the flow of the service instance according to the flow early warning value, a more accurate flow limiting effect can be achieved, and a flow limiting error is reduced, and the flow limiting operation may be performed locally, without accessing a remote dictionary service at a remote end, reducing the load pressure of the remote dictionary service, and finally, a flow processing mechanism is introduced to alleviate the flow blockage situation, further optimizing the flow limiting operation, and the service end only accesses the remote dictionary service when performing flow processing, the traffic generated by traffic processing is small, and excessive pressure on the load of the remote dictionary service is avoided.
Fig. 8 is a block diagram illustrating an electronic device 600 according to an example embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 8, electronic device 600 may include one or more of the following components: processing component 602, memory 604, power component 606, multimedia component 608, audio component 610, input/output (I/O) interface 612, sensor component 614, and communication component 616.
The processing component 602 generally controls overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is used to store various types of data to support operations at the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phonebook data, messages, pictures, multimedia, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power supply component 606 provides power to the various components of electronic device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.
The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense demarcations of a touch or slide action, but also detect a duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 600 is in an operation mode, such as a photographing mode or a multimedia mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is used to output and/or input audio signals. For example, the audio component 610 may include a Microphone (MIC) for receiving external audio signals when the electronic device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor component 614 may detect an open/closed state of the electronic device 600, the relative positioning of components, such as a display and keypad of the electronic device 600, the sensor component 614 may also detect a change in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, orientation or acceleration/deceleration of the electronic device 600, and a change in the temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is operable to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components, and is used to implement a flow control method for a service cluster provided by an embodiment of the present application.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the electronic device 600 to perform the above-described method is also provided. For example, the non-transitory storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 9 is a block diagram illustrating an electronic device 700 in accordance with an example embodiment. For example, the electronic device 700 may be provided as a server. Referring to fig. 9, electronic device 700 includes a processing component 722 that further includes one or more processors, and memory resources, represented by memory 732, for storing instructions, such as applications, that are executable by processing component 722. The application programs stored in memory 732 may include one or more modules that each correspond to a set of instructions. Furthermore, the processing component 722 is configured to execute the instructions to execute a method for controlling flow of a service cluster provided in the embodiment of the present application.
The electronic device 700 may also include a power component 726 that is configured to perform power management of the electronic device 700, a wired or wireless network interface 750 that is configured to connect the electronic device 700 to a network, and an input output (I/O) interface 758. The electronic device 700 may operate based on an operating system stored in memory 732, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
An embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for controlling flow of a service cluster is implemented.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice in the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A flow control method is applied to a server side in a service cluster, and the service cluster further comprises: the system comprises a current limiting processing end and a calling end, wherein at least one calling end is distributed aiming at one server end; a server and a corresponding caller form a call chain, wherein the method comprises:
counting the flow accumulated value of each service instance in the call chain in the current working time period, and executing the flow control operation on the service instance according to the flow accumulated value;
sending a traffic value processing request to the current limit processing end, where the traffic value processing request includes a traffic aggregate value of each service instance of the call chain in the current working time period, and the traffic value processing request is used to: requesting the flow limiting processing end to distribute a flow counteracting value for the flow totalizing value through the remaining amount of the total amount of the flow to be distributed, wherein the flow totalizing value is used for subtracting the flow counteracting value to obtain a processing result;
and executing the flow control operation of the calling chain in the next working time period according to the processing result sent by the current limiting processing end.
2. The method of claim 1, wherein performing the flow control operation on the service instance according to the flow totalization value comprises:
obtaining a traffic quota value of the call chain; the service end comprises at least one service instance, and the service instance is used for realizing the service provided by the service end;
calculating a traffic early warning value corresponding to each call chain according to the number of service instances contained in the service end, the duration of one working time period of the service instances, and traffic quota values corresponding to a plurality of call chains containing the service end, wherein the traffic early warning value is used for representing the maximum processing traffic of each service instance in the call chain;
and in the current working time period, if the traffic accumulated value of the service instance in the call chain exceeds the traffic early warning value corresponding to the call chain, the service end limits the traffic of the service instance.
3. A flow control method is applied to a flow limiting processing end in a service cluster, and the service cluster further comprises: the system comprises a server and a calling end, wherein at least one calling end is distributed for one server; a server and a corresponding caller form a call chain, wherein the method comprises:
acquiring a flow quota value set for the call chain;
calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain;
receiving a flow value processing request sent by the server; the traffic value processing request comprises a traffic accumulated value of each service instance of the call chain in the current working time period;
and distributing a flow counteracting value for the flow accumulative value in the flow value processing request according to the remaining amount of the total amount of the flow to be distributed of the call chain, wherein the flow accumulative value is used for subtracting the flow counteracting value to obtain a processing result, and the processing result is sent to the service end.
4. A flow control method of a service cluster is characterized in that the flow control method is applied to the service cluster which is composed of a flow limiting processing end, a service end and a calling end; at least one calling terminal is distributed aiming at one server terminal; a server and a corresponding calling end form a calling chain, and the server comprises at least one service instance; the service instance is used for realizing the service provided by the service end; the method comprises the following steps:
the server side counts the flow accumulated value of each service instance in a call chain of the server side in the current working time period of the service instance;
the flow limiting processing terminal acquires a flow quota value set for the call chain; calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain;
the service end executes flow control operation on the service instances according to the flow accumulated value, and sends a flow value processing request to the flow limiting processing end, wherein the flow value processing request comprises the flow accumulated value of each service instance of the call chain in the current working time period;
the flow limiting processing terminal receives a flow value processing request sent by the server terminal; distributing a traffic counteracting value for a traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be distributed of the call chain, wherein the traffic accumulated value is used for subtracting the traffic counteracting value to obtain a processing result, and sending the processing result to the service end;
and the server executes the flow control operation of the calling chain in the next working time period according to the processing result sent by the current limiting processing end.
5. A flow control method device is applied to a server side in a service cluster, and the service cluster further comprises: the system comprises a current limiting processing end and a calling end, wherein at least one calling end is distributed aiming at one server end; a server and a corresponding caller form a call chain, wherein the apparatus comprises:
the early warning module is configured to count a traffic accumulated value of each service instance in the call chain in the current working time period, and execute flow control operation on the service instance according to the traffic accumulated value;
a second traffic processing request module configured to send a traffic value processing request to the current limiting processing end, where the traffic value processing request includes a traffic accumulated value of each service instance of the call chain in the current working time period, and the traffic value processing request is used for: requesting the flow limiting processing end to distribute a flow counteracting value for the flow totalizing value through the remaining amount of the total amount of the flow to be distributed, wherein the flow totalizing value is used for subtracting the flow counteracting value to obtain a processing result;
and the second flow processing module is configured to execute the flow control operation on the call chain in the next working time period according to the processing result sent by the flow limiting processing end.
6. A flow control method device is applied to a flow limiting processing end in a service cluster, and the service cluster further comprises: the system comprises a server and a calling end, wherein at least one calling end is distributed for one server; a server and a corresponding caller form a call chain, wherein the apparatus comprises:
a third obtaining module configured to obtain a traffic quota value set for the call chain;
the second quota module is configured to calculate the total amount of the to-be-allocated traffic of the call chain according to the duration of one working time period of the service instance of the server and the traffic quota value of the call chain;
the receiving module is configured to receive a flow value processing request sent by the server; the traffic value processing request comprises a traffic accumulated value of each service instance of the call chain in the current working time period;
and the second traffic processing module is configured to allocate a traffic cancellation value to the traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be allocated of the call chain, wherein the traffic accumulated value is used for subtracting the traffic cancellation value to obtain a processing result, and the processing result is sent to the server.
7. A flow control system of a service cluster is applied to the service cluster consisting of a flow limiting processing end, a service end and a calling end; at least one calling terminal is distributed aiming at one server terminal; a server and a corresponding calling end form a calling chain, and the server comprises at least one service instance; the service instance is used for realizing the service provided by the service end; the server side comprises: the system comprises a first statistical module, a first flow processing request module and a first current limiting operation module; the current limiting processing terminal includes: the system comprises a first quota module and a first traffic processing module;
the first statistic module is configured to count a traffic accumulated value of each service instance in a call chain of the service end in a current working time period of the service instance;
the first quota module is configured to obtain a traffic quota value set for the call chain; calculating the total amount of the flow to be distributed of the call chain according to the duration of one working time period of the service instance of the service end and the flow distribution value of the call chain;
the first traffic processing request module is configured to execute a traffic control operation on the service instance according to the traffic accumulated value, and send a traffic value processing request to the traffic limiting processing end, where the traffic value processing request includes a traffic accumulated value of each service instance of the call chain in the current working time period;
the first traffic processing module is configured to receive a traffic value processing request sent by the server; distributing a traffic counteracting value for a traffic accumulated value in the traffic value processing request according to the remaining amount of the total amount of traffic to be distributed of the call chain, wherein the traffic accumulated value is used for subtracting the traffic counteracting value to obtain a processing result, and sending the processing result to the service end;
and the first current limiting operation module is configured to execute the flow control operation on the call chain in the next working time period according to the processing result sent by the current limiting processing end.
8. An electronic device, comprising: a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of any one of claims 1 to 4.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of any of claims 1-4.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the method of any of claims 1-4 when executed by a processor.
CN202111344771.9A 2021-11-12 2021-11-12 Flow control method and system for service cluster Active CN114172902B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111344771.9A CN114172902B (en) 2021-11-12 2021-11-12 Flow control method and system for service cluster

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111344771.9A CN114172902B (en) 2021-11-12 2021-11-12 Flow control method and system for service cluster

Publications (2)

Publication Number Publication Date
CN114172902A true CN114172902A (en) 2022-03-11
CN114172902B CN114172902B (en) 2024-05-14

Family

ID=80478920

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111344771.9A Active CN114172902B (en) 2021-11-12 2021-11-12 Flow control method and system for service cluster

Country Status (1)

Country Link
CN (1) CN114172902B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114615073A (en) * 2022-03-22 2022-06-10 广州方硅信息技术有限公司 Access flow control method, device, equipment and medium
CN115002043A (en) * 2022-05-30 2022-09-02 重庆长安汽车股份有限公司 Distributed current limiting method, device and storage medium based on registration center

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106330778A (en) * 2016-08-22 2017-01-11 深圳广联赛讯有限公司 Network flow control method and apparatus
CN110166376A (en) * 2019-06-06 2019-08-23 北京百度网讯科技有限公司 Flow control methods and device, system, server, computer-readable medium
CN110198274A (en) * 2019-06-21 2019-09-03 苏宁云计算有限公司 A kind of control method and its system of group flow
CN110708258A (en) * 2019-09-29 2020-01-17 Oppo广东移动通信有限公司 Flow control method, flow control device, server and storage medium
CN110753131A (en) * 2019-11-04 2020-02-04 网易(杭州)网络有限公司 Microservice distributed current limiting method and device, storage medium and electronic equipment
CN112437018A (en) * 2020-11-19 2021-03-02 百度在线网络技术(北京)有限公司 Flow control method, device, equipment and storage medium for distributed cluster
CN113285884A (en) * 2021-07-19 2021-08-20 阿里云计算有限公司 Flow control method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106330778A (en) * 2016-08-22 2017-01-11 深圳广联赛讯有限公司 Network flow control method and apparatus
CN110166376A (en) * 2019-06-06 2019-08-23 北京百度网讯科技有限公司 Flow control methods and device, system, server, computer-readable medium
CN110198274A (en) * 2019-06-21 2019-09-03 苏宁云计算有限公司 A kind of control method and its system of group flow
CN110708258A (en) * 2019-09-29 2020-01-17 Oppo广东移动通信有限公司 Flow control method, flow control device, server and storage medium
CN110753131A (en) * 2019-11-04 2020-02-04 网易(杭州)网络有限公司 Microservice distributed current limiting method and device, storage medium and electronic equipment
CN112437018A (en) * 2020-11-19 2021-03-02 百度在线网络技术(北京)有限公司 Flow control method, device, equipment and storage medium for distributed cluster
CN113285884A (en) * 2021-07-19 2021-08-20 阿里云计算有限公司 Flow control method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114615073A (en) * 2022-03-22 2022-06-10 广州方硅信息技术有限公司 Access flow control method, device, equipment and medium
CN115002043A (en) * 2022-05-30 2022-09-02 重庆长安汽车股份有限公司 Distributed current limiting method, device and storage medium based on registration center

Also Published As

Publication number Publication date
CN114172902B (en) 2024-05-14

Similar Documents

Publication Publication Date Title
CN110515709B (en) Task scheduling system, method, device, electronic equipment and storage medium
US8170491B2 (en) System and method for real-time performance and load statistics of a communications system
CN114172902A (en) Flow control method and system for service cluster
CN111404836B (en) Data transmission control method, device, control center, server and medium
CN109918268B (en) System compatible method, apparatus, device and computer readable storage medium
CN113220482A (en) Call request processing method and device, electronic equipment and storage medium
CN113420338B (en) Data processing method and device for data processing
CN112671897A (en) Access method, device, storage medium, equipment and product of distributed system
CN110138679B (en) Data stream scheduling method and device
EP3982249B1 (en) Delay adjustment method and device, electronic device and storage medium
CN109376013B (en) Load balancing method and device
CN113703962A (en) Cloud resource allocation method and device, electronic equipment and storage medium
CN112256424A (en) Virtual resource processing method, device and system, electronic equipment and storage medium
CN115242456B (en) User license management system, method, device, electronic equipment and storage medium
WO2017066049A1 (en) Managing communication events
WO2017066048A1 (en) Managing communication events
CN116248483A (en) Node abnormal fusing method and device, electronic equipment and storage medium
CN115033369A (en) Thread scheduling method, device and equipment based on task processing
CN112130994B (en) Resource allocation method, device, electronic equipment and storage medium
CN115062921A (en) Carbon emission quota adjusting method and device, storage medium and electronic equipment
CN111245822B (en) Remote procedure call processing method and device and computer storage medium
CN114186894A (en) Project risk detection method and device, electronic equipment and storage medium
CN110716985B (en) Node information processing method, device and medium
CN113965912B (en) Scheduling method, device and equipment for communication software license
CN116915830B (en) Request 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
GR01 Patent grant
GR01 Patent grant