CN116319810A - Flow control method, device, equipment, medium and product of distributed system - Google Patents

Flow control method, device, equipment, medium and product of distributed system Download PDF

Info

Publication number
CN116319810A
CN116319810A CN202310215040.7A CN202310215040A CN116319810A CN 116319810 A CN116319810 A CN 116319810A CN 202310215040 A CN202310215040 A CN 202310215040A CN 116319810 A CN116319810 A CN 116319810A
Authority
CN
China
Prior art keywords
concurrency
service
server
flow control
service request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310215040.7A
Other languages
Chinese (zh)
Inventor
谢福成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech 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 China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202310215040.7A priority Critical patent/CN116319810A/en
Publication of CN116319810A publication Critical patent/CN116319810A/en
Pending legal-status Critical Current

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
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1029Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers using data related to the state of servers by a load balancer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a flow control method, a flow control device, flow control equipment, flow control media and flow control products of a distributed system. The present invention relates to the fields of computer technology, financial science and technology, and information technology. The method comprises the following steps: distributing the received service request to a target server in the distributed system; determining the current server concurrency and/or the current service class concurrency of the target server according to the service request; the flow control is carried out on the target server according to the server concurrency and/or the business category concurrency; if the target server receives the service request, determining the current system concurrency of the distributed system according to the service request; and controlling the flow of the distributed system according to the concurrency of the system. By using the method, the flow control can be effectively realized for each server in the distributed system by carrying out double flow control on the distributed system, and the stability and high availability of the distributed cluster to service response are ensured.

Description

Flow control method, device, equipment, medium and product of distributed system
Technical Field
Embodiments of the present invention relate to the fields of computer technology, financial technology, and information technology, and in particular, to a flow control method, apparatus, device, storage medium, and program product for a distributed system.
Background
Highly available systems typically provide some self-protection capability, often requiring availability of the system by various means, such as caching, demotion, and throttling. When a sudden traffic peak is encountered and the system performance is not supported, the whole system may crash without similar measures to protect the system. In bursty high traffic scenarios, it is anyway not possible to obtain particularly high service capabilities for a short time. Therefore, a flow control mechanism is needed to enable the system to service or to restore service, whether before or after the system crashes and when a reboot is required.
In the existing traffic control based on redis cache, although global control of traffic can be realized, under the distributed application service scene, external services conform to global traffic control, and the services can be distributed on a single server or a plurality of servers in a centralized manner, so that the services of the servers are blocked, and other servers are relatively idle, thereby influencing the external overall service of the application.
Disclosure of Invention
The embodiment of the invention provides a flow control method, a flow control device, flow control equipment and a flow control storage medium of a distributed system, which can realize flow control of each server in the distributed system and ensure the stability and high availability of a distributed cluster to service response.
In a first aspect, an embodiment of the present invention provides a flow control method of a distributed system, including:
distributing the received service request to a target server in the distributed system;
determining the current server concurrency and/or the current service class concurrency of the target server according to the service request; the server concurrency is the total service request concurrency of the target server, and the service category concurrency is the total service request concurrency of the service categories corresponding to the service requests;
the flow control is carried out on the target server according to the server concurrency and/or the business category concurrency;
if the target server receives the service request, determining the current system concurrency of the distributed system according to the service request;
and controlling the flow of the distributed system according to the concurrency of the system.
In a second aspect, an embodiment of the present invention further provides a flow control device of a distributed system, including:
the service request distribution module is used for distributing the received service request to a target server in the distributed system;
the server concurrency determination module is used for determining the current server concurrency and/or service class concurrency of the target server according to the service request; the server concurrency is the total service request concurrency of the target server, and the service category concurrency is the total service request concurrency of the service categories corresponding to the service requests;
the server flow control module is used for controlling the flow of the target server according to the server concurrency and/or the business category concurrency;
the system concurrency determination module is used for determining the current system concurrency of the distributed system according to the service request if the target server receives the service request;
and the system flow control module is used for controlling the flow of the distributed system according to the system concurrency quantity.
In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor executes the program to implement a flow control method of a distributed system according to any one of the embodiments of the present invention.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a flow control method of a distributed system according to any of the embodiments of the present invention.
In a fifth aspect, embodiments of the present invention also provide a computer program product comprising a computer program which, when executed by a processor, implements a flow control method of a distributed system according to any of the embodiments of the present invention.
In the embodiment of the invention, the received service request is distributed to the target server in the distributed system; determining the current server concurrency and/or the current service class concurrency of the target server according to the service request; the flow control is carried out on the target server according to the server concurrency and/or the business category concurrency; if the target server receives the service request, determining the current system concurrency of the distributed system according to the service request; and controlling the flow of the distributed system according to the concurrency of the system. According to the technical scheme, the distributed system is subjected to double flow control, so that the flow control can be effectively realized for each server in the distributed system, and the stability and high availability of the distributed cluster to service response are ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a flow control method for a distributed system according to an embodiment of the present invention;
FIG. 2 is a flow chart of another flow control method for a distributed system according to an embodiment of the present invention;
FIG. 3 is a flow chart of a flow control method of yet another distributed system according to an embodiment of the present invention;
FIG. 4 is a flow chart of a flow control method of yet another distributed system according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a flow control device of a distributed system according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance. The data acquisition, storage, use, processing and the like in the technical scheme meet the relevant regulations of national laws and regulations.
Redis: a memory database mainly uses distributed caching, and when a server side is a multi-server cluster, redis can well solve the problem of cache data synchronization among multiple servers.
Fig. 1 is a flowchart of a flow control method of a distributed system according to an embodiment of the present invention, where the method may be applied to a flow control case of a distributed system, and the flow control device of the distributed system may be implemented in hardware and/or software, and the flow control device of the distributed system may be configured in an electronic device, where the electronic device may be a mobile terminal, a PC end, a server, or the like. As shown in fig. 1, the method includes:
S110, distributing the received service request to a target server in the distributed system.
The service request may be a data service request of an external system received by a data service bus in the distributed system, for example, providing a service addressing service, etc. The target server may be any application server that has registered service information in the distributed system.
Specifically, the service request distribution is random, and the data service bus distributes the received service request to the target server in the distributed system randomly.
And S120, determining the current server concurrency and/or the service class concurrency of the target server according to the service request.
The server concurrency is total service request concurrency of the target server, and the service category concurrency is total service request concurrency belonging to the service category corresponding to the service request.
Specifically, multiple service classes may be supported in the system at the same time, for example, the service classes may be represented by the incoming codes in the service request message, where different incoming codes correspond to different service classes.
In particular, the system may implement data collection at the service request access point, such as may collect critical feature data required to contain control policy logic. Meanwhile, the number of service requests can be determined according to the service requests, and then the system accumulates the number of service requests with the server concurrency to obtain the current server concurrency of the target server. And acquiring service category identifiers of the service requests according to the acquired key characteristic data, and accumulating the quantity of the service requests by the service category concurrency quantity corresponding to the service category identifiers to acquire the current service category concurrency quantity of the target server.
Optionally, the method for determining the current server concurrency and/or the service class concurrency of the target server according to the service request may be: accumulating the quantity of service requests by the server concurrency quantity to obtain the current server concurrency quantity of the target server; acquiring a service category identifier of a service request; and accumulating the quantity of the service requests by the service category concurrency quantity corresponding to the service category identification to obtain the current service category concurrency quantity of the target server.
In particular, the service class identification may be data identifying a specific service class in the key feature data of the service request. For example, the incoming call code in the key feature data in the service request message may be used as a service class identifier, and different service classes may be corresponding according to different service class identifiers.
Specifically, the system may perform data acquisition at the service request access point. And determining the number of service requests according to the service requests, and then accumulating the number of the service requests by the system according to the server concurrency to obtain the current server concurrency of the target server. And acquiring service category identifiers of the service requests according to the acquired key characteristic data, and accumulating the quantity of the service requests by the service category concurrency quantity corresponding to the service category identifiers to acquire the current service category concurrency quantity of the target server.
In this embodiment, by determining the current server concurrency and/or the service class concurrency of the target server, a related flow control policy may be invoked to perform judgment logic processing according to the number of concurrency, so as to determine to implement a release or interception operation on the access request according to the comparison result.
And S130, controlling the flow of the target server according to the server concurrency and/or the business category concurrency.
In particular, the flow control may be to control the visiting service, only allow the meeting service to enter the system, and the exceeding part is rejected, queued or waiting, lowered, etc.
Specifically, firstly, threshold value judgment is performed on the current flow state according to the determined server concurrency and/or service category concurrency, the set related flow control strategy judgment logic is called to process, and flow control is performed on the target server according to the comparison result, namely whether to accept the service request or reject the service request is determined.
Optionally, before the flow control is performed on the target server according to the server concurrency and/or the traffic class concurrency, the method further comprises: configuring a first set threshold corresponding to the target server and a second set threshold corresponding to each business category; wherein the sum of the second set thresholds of the business categories is smaller than or equal to the first set threshold.
Specifically, the first set threshold may be a preset threshold, and the corresponding setting is performed according to the total concurrency of the target server. The second set threshold may be a preset threshold, and the set threshold may be composed of a plurality of thresholds, and corresponding setting is performed according to the traffic class concurrency amount of the target server. That is, different service classes may correspond to a second set threshold corresponding to the service class, where the setting of the threshold may be set according to actual needs, and the embodiment of the present invention is not specifically limited. Wherein the sum of the second set thresholds of the business categories is smaller than or equal to the first set threshold.
Optionally, the manner of performing flow control on the target server according to the server concurrency and/or the traffic class concurrency may be: if the concurrency of the server is smaller than the first set threshold and the concurrency of the service class is smaller than the second set threshold corresponding to the service class, the target server receives the service request; and if the server concurrency is greater than or equal to the first set threshold value and/or the business category concurrency is greater than or equal to the second set threshold value, invoking a set flow control strategy to control the flow of the target server.
Specifically, the set flow control policy may be a set flow control policy, where the flow control policy may include whether to immediately accept the service request or delay accepting the service request or reject the service request. When the set condition is met, the set flow control strategy can be called to control the flow, and the specific flow control strategy can be set according to the actual requirement, and the embodiment of the invention is not particularly limited.
Specifically, the server concurrency is compared with a set first set threshold, meanwhile, the concurrency of the service category is compared with a second set threshold corresponding to the service category, and if the server concurrency is smaller than the first set threshold and the concurrency of the service category is smaller than the second set threshold corresponding to the service category, the target server receives the service request. And if the server concurrency is greater than or equal to the first set threshold value and/or the business category concurrency is greater than or equal to the second set threshold value, invoking a set flow control strategy to control the flow of the target server.
Optionally, the manner of calling the set flow control policy to perform flow control on the target server may be: the service request is denied.
And when the server concurrency is greater than or equal to a first set threshold value and/or the service category concurrency is greater than or equal to a second set threshold value, the service request can be directly refused.
Optionally, the manner of calling the set flow control policy to perform flow control on the target server may be: caching the service request set time, and if the target server reaches a state that the server concurrency is smaller than a first set threshold and the service class concurrency is smaller than a second set threshold corresponding to the service class within the set time, receiving the service request by the target server; and if the target server is kept in a state that the server concurrency is greater than or equal to a first set threshold value and/or the business category concurrency is greater than or equal to a second set threshold value within the set duration, rejecting the business request.
Specifically, when the server concurrency is greater than or equal to a first set threshold and/or the service category concurrency is greater than or equal to a second set threshold, the service request may be put into the cache first, and if the target server reaches a state that the server concurrency is less than the first set threshold and the service category concurrency is less than the second set threshold corresponding to the service category within a set duration, the target server receives the service request. And rejecting the service request if the target server still remains in a state that the server concurrency is greater than or equal to a first set threshold and/or the service class concurrency is greater than or equal to a second set threshold within the set duration. The set duration may be set to 5 seconds or 10s, etc., and is set according to actual needs, which is not specifically limited in the embodiment of the present invention.
Optionally, the manner of calling the set flow control policy to perform flow control on the target server may be: and forwarding the service request to other servers in the distributed system so that the other servers can perform flow control on the service request.
Specifically, when the server concurrency is greater than or equal to the first set threshold and/or the service class concurrency is greater than or equal to the second set threshold, or if the target server still remains in a state that the server concurrency is greater than or equal to the first set threshold and/or the service class concurrency is greater than or equal to the second set threshold within a set duration, the service request may be forwarded to other servers in the distributed system, so that the other servers perform flow control on the service request. The manner in which the other servers perform flow control on the service request is the same as the foregoing manner, and is not described herein again.
In the embodiment, through a flow control strategy, flow control can be realized for each server in the distributed system, and the stability and high availability of the distributed cluster to service response are ensured.
Optionally, after rejecting the service request, the method further includes: and updating the server concurrency and/or the service class concurrency of the target server according to the number of the service requests.
Specifically, after the service request is refused, the server concurrency and/or the service category concurrency of the target server are updated according to the server concurrency and/or the service category concurrency of the target server minus the number of the service requests.
In this embodiment, by updating the concurrency amount, each server continues to implement flow control according to the method described above, so as to ensure accuracy of flow control.
And S140, if the target server receives the service request, determining the current system concurrency of the distributed system according to the service request.
Specifically, if the target server receives the service request, determining a corresponding system concurrency amount according to the acquired key information of the service request, and then accumulating the number of the service requests by the system concurrency amount corresponding to the key information to obtain the current system concurrency amount of the key information of the distributed system.
Optionally, the method for determining the system concurrency of the distributed system according to the service request may be: acquiring key information of a service request; wherein, the key information includes: service class, service subcategory and security node information; and accumulating the number of the service requests by the system concurrency quantity corresponding to the key information to obtain the current system concurrency quantity of the key information of the distributed system.
Specifically, multiple service categories can be supported in the system at the same time, and key information of the service request is obtained, wherein the key information comprises: traffic class, traffic subcategory and security node information. The incoming codes in the service request message are a1271D001, a1271D002, etc., corresponding to different service classes. Specific service subcategories are defined under each service category through the subcategory numbers in the message, and the specific service subcategories are exemplified as NEDPST 001, NEDPST 002 and the like, and correspond to different outbound system sources through the safety node information in the message. For example, the ORACLE online real-time synchronization query corresponding to a1271D001, the sub-service number nedcst 001 represents a customer credit rating query, and nedcst 002 represents a customer credit rating query; the security node information 10001 may be a risk application system and 10002 may be a customer marketing system. And finally, determining the corresponding system concurrency according to the key information and accumulating the number of service requests to obtain the current system concurrency of the key information of the distributed system.
And S150, controlling the flow of the distributed system according to the concurrency of the system.
Specifically, the flow control may control the visiting service according to the indexes of flow, concurrent thread number, response time and the like, only the service meeting the requirement is allowed to enter the system, and the excess service is rejected, queued or waiting, reduced and the like.
Specifically, firstly, threshold judgment is performed on the current flow state according to the determined system concurrency, the set related flow control strategy judgment logic is called to process, and flow control is performed on the distributed system according to the comparison result, namely, whether to accept the service request or reject the service request is determined.
Optionally, the manner of controlling the flow rate of the distributed system according to the concurrency of the system may be: acquiring a third set threshold corresponding to the key information from the Redis cache; if the concurrency of the system is smaller than a third set threshold, processing the service request; and if the system concurrency is greater than or equal to a third set threshold, rejecting the service request.
Specifically, the third set threshold may be a preset threshold, and the corresponding setting is performed according to the key information in the dis cache. The specific threshold setting may be set according to actual needs, and is not specifically limited in the embodiment of the present invention.
Specifically, a third set threshold corresponding to the key information is obtained from the Redis cache. And comparing the concurrency of the system with a third set threshold, and if the concurrency of the system is smaller than the third set threshold, processing the service request. And if the system concurrency is greater than or equal to a third set threshold, rejecting the service request.
In this embodiment, under the condition that service application requests are high in concurrency, concurrency control is performed on various specific service requests, even including a service request system, so that the application system is ensured to effectively and uniformly control access of various transactions according to actual service needs, and a global flow control scene is realized by using the Redis cache.
Optionally, after rejecting the service request, the method further includes: and updating the system concurrency corresponding to the key information according to the number of the service requests.
Specifically, after the service request is refused, the system concurrency and/or the service category concurrency of the distributed system are updated according to the system concurrency and/or the service category concurrency of the distributed system minus the number of the service requests.
In the embodiment of the invention, the received service request is distributed to the target server in the distributed system; determining the current server concurrency and/or the service class concurrency of the target server according to the service request; controlling the flow of the target server according to the server concurrency and/or the business category concurrency; if the target server receives the service request, determining the current system concurrency of the distributed system according to the service request; and controlling the flow of the distributed system according to the concurrency of the system. By using the method, the flow control can be effectively realized for each server in the distributed system by carrying out double flow control on the distributed system, and the stability and high availability of the distributed cluster to service response are ensured.
Fig. 2 is a flowchart of another flow control method of a distributed system according to an embodiment of the present invention, where the embodiment of the present invention is embodied on the basis of the above embodiment of the present invention, and referring to fig. 2, the method provided by the embodiment of the present invention specifically includes the following steps:
s210, distributing the received service request to a target server in the distributed system.
S220, accumulating the server concurrency amount to the number of service requests to obtain the current server concurrency amount of the target server.
S230, obtaining the service type identification of the service request.
The correspondence relationship between the setting rule and the interaction task may be one-to-one, one-to-many, or many-to-many. In this embodiment, after determining the setting rule, one or more corresponding interaction tasks may be determined according to the setting rule.
S240, accumulating the quantity of the service requests by the service category concurrency quantity corresponding to the service category identification, and obtaining the current service category concurrency quantity of the target server.
S250, controlling the flow of the target server according to the server concurrency and/or the business category concurrency.
S260, determining the system concurrency of the distributed system according to the service request.
And S270, controlling the flow of the distributed system according to the concurrency of the system.
Fig. 3 is a flowchart of another flow control method of a distributed system according to an embodiment of the present invention, where the embodiment of the present invention is embodied on the basis of the above embodiment of the present invention, and referring to fig. 3, the method provided by the embodiment of the present invention specifically includes the following steps:
and S310, distributing the received service request to a target server in the distributed system.
S320, determining the current server concurrency and/or the service class concurrency of the target server according to the service request.
S330, comparing the server concurrency and the business category concurrency with a first set threshold and a second set threshold respectively.
And S340, if the server concurrency is smaller than the first set threshold and the business category concurrency is smaller than the second set threshold corresponding to the business category, the target server receives the business request.
S350, if the server concurrency is greater than or equal to a first set threshold value and/or the business category concurrency is greater than or equal to a second set threshold value, a set flow control strategy is called to control the flow of the target server.
S360, determining the system concurrency of the distributed system according to the service request.
And S370, controlling the flow of the distributed system according to the concurrency of the system.
Fig. 4 is a flowchart of a flow control method of a distributed system according to another embodiment of the present invention.
The method comprises the following specific steps:
s410, distributing the received service request to a target server in the distributed system.
S420, determining the current server concurrency and/or the service class concurrency of the target server according to the service request.
And S430, controlling the flow of the target server according to the server concurrency and/or the business category concurrency.
S440, obtaining key information of a service request; wherein, the key information includes: traffic class, traffic subcategory and security node information.
S450, accumulating the system concurrency corresponding to the key information into the number of service requests to obtain the current system concurrency of the key information of the distributed system.
S460, acquiring a third set threshold corresponding to the key information from the Redis cache. And comparing the system concurrency with a third set threshold.
And S470, if the system concurrency is smaller than a third set threshold, processing the service request.
And S480, if the system concurrency is greater than or equal to a third set threshold, rejecting the service request.
Fig. 5 is a schematic structural diagram of a flow control device of a distributed system according to an embodiment of the present invention. As shown in fig. 5, a service request allocation module 510, a server concurrency determination module 520, a server flow control module 530, a system concurrency determination module 540, and a system flow control module 550;
A service request distribution module 510, configured to distribute a received service request to a target server in the distributed system;
a server concurrency determination module 520, configured to determine a current server concurrency and/or a current service class concurrency of the target server according to the service request; the server concurrency is the total service request concurrency of the target server, and the service category concurrency is the total service request concurrency of the service categories corresponding to the service requests;
a server flow control module 530, configured to perform flow control on the target server according to the server concurrency and/or the traffic class concurrency;
a system concurrency determination module 540, configured to determine, if the target server accepts the service request, a current system concurrency of the distributed system according to the service request;
and a system flow control module 550, configured to perform flow control on the distributed system according to the system concurrency.
In the embodiment of the invention, the received service request is distributed to the target server in the distributed system; determining the current server concurrency and/or the current service class concurrency of the target server according to the service request; the flow control is carried out on the target server according to the server concurrency and/or the business category concurrency; if the target server receives the service request, determining the current system concurrency of the distributed system according to the service request; and controlling the flow of the distributed system according to the concurrency of the system. By using the method, the flow control can be effectively realized for each server in the distributed system by carrying out double flow control on the distributed system, and the stability and high availability of the distributed cluster to service response are ensured.
Alternatively, the server concurrency determination module 520 may be specifically configured to:
accumulating the server concurrency amount by the number of the service requests to obtain the current server concurrency amount of the target server;
acquiring a service category identifier of the service request;
accumulating the quantity of the service requests by the service category concurrency quantity corresponding to the service category identification to obtain the current service category concurrency quantity of the target server.
Alternatively, the server flow control module 530 may be specifically configured to:
if the server concurrency is smaller than a first set threshold and the business category concurrency is smaller than a second set threshold corresponding to the business category, the target server receives the business request;
and if the server concurrency is greater than or equal to the first set threshold value and/or the business category concurrency is greater than or equal to the second set threshold value, invoking a set flow control strategy to control the flow of the target server.
Alternatively, the server flow control module 530 may be specifically configured to:
and rejecting the service request.
Alternatively, the server flow control module 530 may be specifically configured to:
Caching the service request set time, and if the target server reaches a state that the server concurrency is smaller than a first set threshold and the service class concurrency is smaller than a second set threshold corresponding to the service class within the set time, receiving the service request by the target server;
and if the target server is kept in a state that the server concurrency is greater than or equal to the first set threshold value and/or the business category concurrency is greater than or equal to the second set threshold value within the set duration, rejecting the business request.
Alternatively, the server flow control module 530 may be specifically configured to:
and forwarding the service request to other servers in the distributed system, so that the other servers perform flow control on the service request.
Optionally, after rejecting the service request, the apparatus may be further specifically configured to:
and updating the server concurrency and/or the service class concurrency of the target server according to the quantity of the service requests.
Optionally, before the flow control is performed on the target server according to the server concurrency and/or the traffic class concurrency, the apparatus may be further specifically configured to:
Configuring a first set threshold corresponding to the target server and a second set threshold corresponding to each business category; and the sum of the second set thresholds of the business categories is smaller than or equal to the first set threshold.
Optionally, the system concurrency determination module 540 may be specifically configured to:
acquiring key information of the service request; wherein the key information includes: service class, service subcategory and security node information;
and accumulating the number of the service requests by the system concurrency quantity corresponding to the key information to obtain the current system concurrency quantity of the key information of the distributed system.
Alternatively, the system flow control module 550 may be specifically configured to:
acquiring a third set threshold corresponding to the key information from a Redis cache;
if the system concurrency is smaller than the third set threshold, processing the service request;
and if the system concurrency is greater than or equal to the third set threshold, rejecting the service request.
Optionally, after rejecting the service request, the apparatus may be further specifically configured to:
and updating the system concurrency corresponding to the key information according to the number of the service requests.
The flow control device of the distributed system provided by the embodiment of the invention can execute the flow control method of the distributed system provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. Fig. 6 shows a block diagram of an electronic device 12 suitable for use in implementing embodiments of the present invention. The electronic device 12 shown in fig. 6 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention. Device 12 is typically an electronic device that implements flow control of a distributed system.
As shown in fig. 6, the electronic device 12 is in the form of a general purpose computing device. Components of the electronic device 12 may include, but are not limited to: one or more processors 16, a memory 28, a bus 18 that connects the various system components, including the memory 28 and the processor 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include industry standard architecture (Industry Standard Architecture, ISA) bus, micro channel architecture (Micro Channel Architecture, MCA) bus, enhanced ISA bus, video electronics standards association (Video Electronics Standards Association, VESA) local bus, and peripheral component interconnect (Peripheral Component Interconnect, PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (Random Access Memory, RAM) 30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, commonly referred to as a "hard disk drive"). Although not shown in fig. 6, a disk drive for reading from and writing to a removable nonvolatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from and writing to a removable nonvolatile optical disk (e.g., a Compact Disc-Read Only Memory (CD-ROM), digital versatile Disc (Digital Video Disc-Read Only Memory, DVD-ROM), or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
Programs 36 having a set (at least one) of program modules 26 may be stored, for example, in the storage 28, such program modules 26 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 26 generally perform the functions and/or methods of the embodiments described herein.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, camera, display 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and/or any devices (e.g., network card, modem, etc.) that enable the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., local area network (Local Area Network, LAN), wide area network Wide Area Network, WAN) and/or a public network, such as the internet) via the network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 over the bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk array (Redundant Arrays of Independent Disks, RAID) systems, tape drives, data backup storage systems, and the like.
The processor 16 executes various functional applications and data processing by running programs stored in the memory 28, for example, to implement the flow control method of the distributed system provided by the above-described embodiments of the present invention.
The embodiment of the invention provides a computer readable storage medium, and a computer program is stored on the computer readable storage medium, and when the program is executed by a processing device, the flow control method of the distributed system is realized. The computer readable medium of the present invention described above may be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: when a target user triggers an intelligent customer service, acquiring a user identifier of the target user; determining at least one interaction task according to the user identification; wherein the interactive task comprises a plurality of task elements; determining a target interaction task from the at least one interaction task according to the task element; and executing the target interaction task to interact with the target user.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
Embodiments of the present invention also provide a computer program product comprising a computer program which, when executed by a processor, implements a flow control method of a distributed system as provided by any of the embodiments of the present application.
Computer program product in the implementation, the computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (15)

1. A flow control method of a distributed system, wherein the distributed system comprises a plurality of servers; comprising the following steps:
distributing the received service request to a target server in the distributed system;
determining the current server concurrency and/or the current service class concurrency of the target server according to the service request; the server concurrency is the total service request concurrency of the target server, and the service category concurrency is the total service request concurrency of the service categories corresponding to the service requests;
The flow control is carried out on the target server according to the server concurrency and/or the business category concurrency;
if the target server receives the service request, determining the current system concurrency of the distributed system according to the service request;
and controlling the flow of the distributed system according to the concurrency of the system.
2. The method according to claim 1, wherein determining the current server concurrency and/or traffic class concurrency for the target server based on the traffic request comprises:
accumulating the server concurrency amount by the number of the service requests to obtain the current server concurrency amount of the target server;
acquiring a service category identifier of the service request;
accumulating the quantity of the service requests by the service category concurrency quantity corresponding to the service category identification to obtain the current service category concurrency quantity of the target server.
3. The method according to claim 1, wherein the flow control of the target server according to the server concurrency and/or traffic class concurrency comprises:
if the server concurrency is smaller than a first set threshold and the business category concurrency is smaller than a second set threshold corresponding to the business category, the target server receives the business request;
And if the server concurrency is greater than or equal to the first set threshold value and/or the business category concurrency is greater than or equal to the second set threshold value, invoking a set flow control strategy to control the flow of the target server.
4. A method according to claim 3, wherein invoking a set flow control policy for flow control of the target server comprises:
and rejecting the service request.
5. A method according to claim 3, wherein invoking a set flow control policy for flow control of the target server comprises:
caching the service request set time, and if the target server reaches a state that the server concurrency is smaller than a first set threshold and the service class concurrency is smaller than a second set threshold corresponding to the service class within the set time, receiving the service request by the target server;
and if the target server is kept in a state that the server concurrency is greater than or equal to the first set threshold value and/or the business category concurrency is greater than or equal to the second set threshold value within the set duration, rejecting the business request.
6. A method according to claim 3, wherein invoking a set flow control policy for flow control of the target server comprises:
and forwarding the service request to other servers in the distributed system, so that the other servers perform flow control on the service request.
7. The method according to claim 4 or 5, further comprising, after rejecting the service request:
and updating the server concurrency and/or the service class concurrency of the target server according to the quantity of the service requests.
8. A method according to claim 3, further comprising, prior to flow control of the target server in accordance with the server concurrency and/or traffic class concurrency:
configuring a first set threshold corresponding to the target server and a second set threshold corresponding to each business category; and the sum of the second set thresholds of the business categories is smaller than or equal to the first set threshold.
9. The method of claim 1, wherein determining a system concurrency of the distributed system based on the service request comprises:
acquiring key information of the service request; wherein the key information includes: service class, service subcategory and security node information;
And accumulating the number of the service requests by the system concurrency quantity corresponding to the key information to obtain the current system concurrency quantity of the key information of the distributed system.
10. The method of claim 9, wherein flow controlling the distributed system according to the system concurrency comprises:
acquiring a third set threshold corresponding to the key information from a Redis cache;
if the system concurrency is smaller than the third set threshold, processing the service request;
and if the system concurrency is greater than or equal to the third set threshold, rejecting the service request.
11. The method of claim 10, further comprising, after rejecting the service request:
and updating the system concurrency corresponding to the key information according to the number of the service requests.
12. A flow control device for a distributed system, comprising:
the service request distribution module is used for distributing the received service request to a target server in the distributed system;
the server concurrency determination module is used for determining the current server concurrency and/or service class concurrency of the target server according to the service request; the server concurrency is the total service request concurrency of the target server, and the service category concurrency is the total service request concurrency of the service categories corresponding to the service requests;
The server flow control module is used for controlling the flow of the target server according to the server concurrency and/or the business category concurrency;
the system concurrency determination module is used for determining the current system concurrency of the distributed system according to the service request if the target server receives the service request;
and the system flow control module is used for controlling the flow of the distributed system according to the system concurrency quantity.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable by the processor, wherein the processor implements a method of flow control of a distributed system as claimed in any one of claims 1 to 11 when executing the computer program.
14. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements a flow control method of a distributed system according to any of claims 1-11.
15. A computer program product comprising a computer program which, when executed by a processor, implements a flow control method of a distributed system according to any of claims 1-11.
CN202310215040.7A 2023-02-28 2023-02-28 Flow control method, device, equipment, medium and product of distributed system Pending CN116319810A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310215040.7A CN116319810A (en) 2023-02-28 2023-02-28 Flow control method, device, equipment, medium and product of distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310215040.7A CN116319810A (en) 2023-02-28 2023-02-28 Flow control method, device, equipment, medium and product of distributed system

Publications (1)

Publication Number Publication Date
CN116319810A true CN116319810A (en) 2023-06-23

Family

ID=86814457

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310215040.7A Pending CN116319810A (en) 2023-02-28 2023-02-28 Flow control method, device, equipment, medium and product of distributed system

Country Status (1)

Country Link
CN (1) CN116319810A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116668372A (en) * 2023-08-01 2023-08-29 腾讯科技(深圳)有限公司 Flow control method and related device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116668372A (en) * 2023-08-01 2023-08-29 腾讯科技(深圳)有限公司 Flow control method and related device
CN116668372B (en) * 2023-08-01 2023-11-03 腾讯科技(深圳)有限公司 Flow control method and related device

Similar Documents

Publication Publication Date Title
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
CN110401720B (en) Information processing method, device, system, application server and medium
CN108897854B (en) Monitoring method and device for overtime task
CN107451853B (en) Method, device and system for real-time red packet distribution and storage medium
CN111127181A (en) Voucher bookkeeping method and device
CN111221638A (en) Scheduling processing method, device, equipment and medium for concurrent tasks
CN113361838A (en) Business wind control method and device, electronic equipment and storage medium
CN110673933A (en) ZooKeeper-based distributed asynchronous queue implementation method, device, equipment and medium
CN110727507B (en) Message processing method and device, computer equipment and storage medium
CN116319810A (en) Flow control method, device, equipment, medium and product of distributed system
CN109657485B (en) Authority processing method and device, terminal equipment and storage medium
CN108520401B (en) User list management method, device, platform and storage medium
CN110245014B (en) Data processing method and device
CN110232136A (en) A kind of big data processing system based on cloud computing
CN109308219B (en) Task processing method and device and distributed computer system
CN116886626A (en) Service data flow limiting method and device, computer equipment and storage medium
CN113779021B (en) Data processing method, device, computer system and readable storage medium
CN115525411A (en) Method, device, electronic equipment and computer readable medium for processing service request
CN115563160A (en) Data processing method, data processing device, computer equipment and computer readable storage medium
CN111866171B (en) Message processing method, device, electronic equipment and medium
CN114374657A (en) Data processing method and device
CN113765871A (en) Fortress management method and device
CN112612959B (en) Push information processing method, device, equipment and medium
CN115564455A (en) Intelligent customer service interaction method, device, equipment, storage medium and program product
CN117057815A (en) Unmanned network virtual seat service method, system, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination