CN111897659B - Method, system and device for controlling service processing frequency and electronic equipment - Google Patents

Method, system and device for controlling service processing frequency and electronic equipment Download PDF

Info

Publication number
CN111897659B
CN111897659B CN202011045773.3A CN202011045773A CN111897659B CN 111897659 B CN111897659 B CN 111897659B CN 202011045773 A CN202011045773 A CN 202011045773A CN 111897659 B CN111897659 B CN 111897659B
Authority
CN
China
Prior art keywords
service
target service
server
request
frequency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011045773.3A
Other languages
Chinese (zh)
Other versions
CN111897659A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011045773.3A priority Critical patent/CN111897659B/en
Publication of CN111897659A publication Critical patent/CN111897659A/en
Application granted granted Critical
Publication of CN111897659B publication Critical patent/CN111897659B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5072Grid computing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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/215Flow control; Congestion control using token-bucket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5013Request control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/506Constraint
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/508Monitor

Abstract

The embodiment of the invention discloses a method, a system, a device and electronic equipment for controlling service processing frequency, which can be applied to the field of service processing of cloud service; in the embodiment of the invention, the server can obtain and determine the token quantity at the current moment based on the user configuration frequency and the token quantity at the previous moment, calculate the punishment time period according to the token quantity at the current moment and the request accumulation quantity of the target service obtained from the client, and send the punishment time period to the client; when the current time is within the punishment time period, the client can inform the target service of refusing to receive the service request, and when the current time is outside the punishment time period, the client can inform the target service of receiving the service request. In the scheme, the client sends the request accumulation amount of the service to the server through the network, so that the server returns a punishment time period to the client according to the request accumulation amount, and the service flow control based on the punishment time period is realized. Therefore, the scheme can improve the control efficiency of the service processing frequency.

Description

Method, system and device for controlling service processing frequency and electronic equipment
Technical Field
The invention relates to the field of computers, in particular to a method, a system, a device and electronic equipment for controlling service processing frequency.
Background
In the field of software architecture and programming, a foreground (front) is a part of a software system which directly interacts with a user and can send a service request to a background (background) which is responsible for processing the service request of a front end, and performing logic processing and data interaction. Due to diversification of services, change of service scenes and the like, a background often needs to process irregular burst traffic, that is, the background needs to deal with a suddenly increased request amount, and when the request amount is too much and exceeds the processing capability of the background, safety problems such as congestion, downtime, abnormal processing and the like may occur in the background. In order to reduce the operation pressure of the background, the number of the requests sent to the background by the foreground can be controlled to be limited within a safe range, so that the frequency of the requests received by the background is controlled.
However, the current control method for the traffic processing frequency of the traffic is inefficient.
Disclosure of Invention
The embodiment of the invention provides a method, a system, a device and an electronic device for controlling service processing frequency, which can improve the control efficiency of the service processing frequency.
The embodiment of the invention provides a method for controlling service processing frequency, which is suitable for a client and comprises the following steps:
obtaining a punishment period of the target service from a server;
when the current time is within the punishment time period, informing the target service of refusing to receive the service request;
when the current time is out of the punishment period, informing the target service of receiving the service request;
when a target service receives a service request, determining the request accumulation amount of the target service;
and sending the request accumulation amount of the target service to the server so that the server can recalculate the punishment time period of the target service according to the request accumulation amount of the target service.
The embodiment of the invention provides a method for controlling service processing frequency, which is suitable for a server and comprises the following steps:
acquiring user configuration frequency and determining the number of tokens at the last moment;
determining the number of tokens at the current moment based on the user configuration frequency and the number of tokens at the previous moment;
when the request accumulation amount of the target service is acquired from the client, calculating a punishment period according to the request accumulation amount of the target service and the number of tokens at the current moment;
and sending the punishment period to the client so that the client processes the service request of the target service according to the punishment period.
The embodiment of the invention provides a control system of service processing frequency, which comprises a client and a server, wherein the client is communicated with the server, and the control system comprises:
a client for:
obtaining a punishment period of the target service from a server;
when the current time is within the punishment time period, informing the target service of refusing to receive the service request;
when the current time is out of the punishment period, informing the target service of receiving the service request;
when a target service receives a service request, determining the request accumulation amount of the target service;
sending the request accumulation amount of the target service to a server so that the server can recalculate the punishment time period of the target service according to the request accumulation amount of the target service;
a server to:
acquiring user configuration frequency of a target service and determining the number of tokens of the target service at the last moment;
determining the token number of the target service at the current moment based on the user configuration frequency of the target service and the token number of the target service at the last moment;
when the request accumulation amount of the target service is acquired from the client, calculating a punishment period of the target service according to the request accumulation amount of the target service and the token number of the target service at the current moment;
and sending the punishment period to the client so that the client processes the service request of the target service according to the punishment period.
An embodiment of the present invention further provides a device for controlling service processing frequency, which is suitable for a client, and includes:
the punishment obtaining unit is used for obtaining punishment time intervals of the target service from the server;
the rejection unit is used for informing the target service of rejecting to receive the service request when the current time is within the punishment time interval;
the receiving unit is used for informing the target service of receiving the service request when the current time is out of the punishment period;
the accumulation unit is used for determining the request accumulation amount of the target service when the target service receives the service request;
and the accumulation sending unit is used for sending the request accumulation of the target service to the server so that the server can recalculate the punishment period of the target service according to the request accumulation of the target service.
An embodiment of the present invention further provides a device for controlling service processing frequency, which is suitable for a server, and includes:
the configuration unit is used for acquiring the user configuration frequency of the target service and determining the number of tokens at the last moment of the target service;
the token unit is used for determining the token number of the target service at the current moment based on the user configuration frequency of the target service and the token number of the target service at the last moment;
the penalty calculation unit is used for calculating a penalty period of the target service according to the request accumulation amount of the target service and the token number of the target service at the current moment when the request accumulation amount of the target service is acquired from the client;
and the punishment sending unit is used for sending the punishment period to the client so that the client can process the service request of the target service according to the punishment period.
The embodiment of the invention also provides the electronic equipment, which comprises a memory, a storage and a control unit, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in any service processing frequency control method provided by the embodiment of the invention.
The embodiment of the present invention further provides a computer-readable storage medium, where multiple instructions are stored in the computer-readable storage medium, and the instructions are suitable for being loaded by a processor to execute the steps in any one of the methods for controlling a service processing frequency provided in the embodiments of the present invention.
In the embodiment of the invention, the server can obtain the user configuration frequency and determine the number of tokens at the last moment; determining the number of tokens at the current moment based on the user configuration frequency and the number of tokens at the previous moment; when the request accumulation amount of the target service is acquired from the client, calculating a punishment period according to the request accumulation amount of the target service and the number of tokens at the current moment; and sending the punishment period to the client so that the client processes the service request of the target service according to the punishment period.
The client can obtain the punishment time period of the target service from the server; when the current time is within the punishment time period, informing the target service of refusing to receive the service request; when the current time is out of the punishment period, informing the target service of receiving the service request; when a target service receives a service request, determining the request accumulation amount of the target service; and sending the request accumulation amount of the target service to the server so that the server can recalculate the punishment time period of the target service according to the request accumulation amount of the target service.
In the embodiment of the invention, the client side counts the request accumulation amount of the target service and sends the request accumulation amount to the server, so that the server calculates the punishment time period of the target service according to the request accumulation amount, and after the server sends the punishment time period to the client side, the client side can control the target service to reject the service request in the punishment time period, thereby realizing the control of the service processing frequency of the received service request, and preventing the target service from generating safety problems of abnormal service, downtime and the like due to excessive application amount.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a is a schematic structural diagram of a control system for service processing frequency according to an embodiment of the present invention;
fig. 1b is a schematic flowchart of a method for controlling service processing frequency applicable to a client according to an embodiment of the present invention;
fig. 2a is a schematic flow chart of a method for controlling service processing frequency of a server according to an embodiment of the present invention;
fig. 2b is a schematic structural and flow diagram of a cloud system for controlling distributed service processing frequency according to an embodiment of the present invention;
FIG. 2c is a schematic diagram of a consistent hashing algorithm according to an embodiment of the present invention;
FIG. 2d is a schematic diagram of the frequency adjustment effect provided by the embodiment of the present invention;
fig. 3a is a schematic diagram of a first structure of a control device for service processing frequency of a client according to an embodiment of the present invention;
fig. 3b is a schematic diagram of a second structure of a control device for service processing frequency of a client according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a control device for service processing frequency of a server according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a method, a system, a device and electronic equipment for controlling service processing frequency.
The control device of the service processing frequency may be specifically integrated in an electronic device, and the electronic device may be a terminal, a server, or other devices.
In some embodiments, the server may also be implemented in the form of a terminal.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and an artificial intelligence platform, but is not limited thereto.
Where distributed is an algorithm in a computer, the computation becomes "distributed" when programs and data for the computer are distributed over a network to more than one computer.
The terminal may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, or the like, but is not limited thereto. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
The embodiment of the invention introduces a control method of service processing frequency by taking the example that a control device of service processing frequency suitable for a server is integrated in a server cluster consisting of cloud servers and a control device of service processing frequency suitable for a client is integrated in the server.
Referring to fig. 1a, this embodiment may be applied to a traffic limiting scenario of an internet service background, and an embodiment of the present invention provides a service processing frequency control system, which includes a client 10, a server cluster 11, and the like.
Wherein the control device for the service processing frequency of the server is integrated in the server cluster 11, the control device for the service processing frequency of the client is integrated in the client 10, and the client 10 can communicate with the server cluster 11.
Wherein, the client 10 can obtain the penalty period of the target service from the server 11; when the current time is within the punishment time period, informing the target service of refusing to receive the service request; when the current time is out of the punishment period, informing the target service of receiving the service request; when a target service receives a service request sent by a service foreground, determining the request accumulation amount of the target service; and sending the request accumulation amount of the target service to the server cluster 11, so that the server cluster 11 recalculates the punishment period of the target service according to the request accumulation amount of the target service.
The server cluster 11 may obtain the user configuration frequency and determine the number of tokens at the previous time; determining the number of tokens at the current moment based on the user configuration frequency and the number of tokens at the previous moment; when the request accumulation amount of the target service is acquired from the client, calculating a punishment period according to the request accumulation amount of the target service and the number of tokens at the current moment; the penalty period is sent to the client 10, so that the client 10 processes the service request of the target service according to the penalty period.
In some embodiments, the control system for service processing frequency may further include a service end 12, where the service end 12 runs at least one service, including a target service; the service end 12 can process a service request sent by a service foreground, the service end 12 can communicate with the client 10 through a network to access a control system of service processing frequency, so as to call a control method of service processing frequency carried in the client 10, and the service end can close a service receiving function of a target service when the client informs the target service that the target service refuses to receive the service request; when the client informs the target service to receive the service request, the service receiving function of the target service is started; and when receiving the service request of the target service, processing the service request according to the preset service processing operation.
In some embodiments, the control system for the service processing frequency may further include a database 13, where the database 13 may be in communication with the server cluster 11, and the server cluster 11 may listen to the interface by determining a parameter; when a data updating event occurs in the database 13 is monitored through the parameter monitoring interface, acquiring a service parameter from the database 13 through the parameter monitoring interface; acquiring the last user configuration frequency; and updating the last user configuration frequency according to the service parameters to obtain the user configuration frequency, so as to obtain the user configuration frequency from the database 13.
In some embodiments, the control system for the service processing frequency may further include a user configuration platform 14, the database 13 and the user configuration platform 14 may communicate, and the database 13 may periodically pull the service parameters from the user configuration platform 14; executing a data updating event based on the service parameter so that the server cluster 11 listens for the data updating event through the parameter listening interface; and sending the service parameters to a parameter monitoring interface of the server cluster 11, so that the server cluster 11 acquires the service parameters from the database 13 through the parameter monitoring interface.
The user configuration platform 14 may receive service parameters configured by the user for the target service; the service parameters are sent to the database 13 periodically so that the database 13 sends the service parameters to the parameter listening interface of the server cluster 11.
The following are detailed below. The numbers in the following examples are not intended to limit the order of preference of the examples.
The embodiment of the present invention will be described in terms of a control device of a service processing frequency, which may be specifically integrated in a server, for example, may be integrated in the server in the form of a program.
The method for controlling service processing frequency suitable for the client provided in the embodiment of the present invention may be executed by a processor of a server, as shown in fig. 1b, and a specific process of the method for controlling service processing frequency may be as follows:
101. and acquiring the punishment period of the target service from the server.
The business service refers to a functional module constituting a program application, for example, for a payment application, it may be composed of an amount inquiry service, a transfer service, a payment service, and the like.
In some embodiments, a program application may be separated and installed in a business foreground (foreground for short) and a business background (background for short) according to its function, where the foreground and the background may process different business services of the program application, the foreground is a part of the program application that directly interacts with a user, and the background is a part of performing a series of responses and processes on a business request sent by the foreground.
The server can provide the client with punishment periods of a plurality of different business services, wherein the business services comprise target business.
The punishment period is a period in which a certain service is punished to make it unable to receive a service request, that is, in the punishment period, the service in the background refuses to receive the service request sent by the service foreground, and outside the punishment period, the service can receive the service request.
102. And when the current time is within the punishment period, informing the target service of refusing to receive the service request.
The current time refers to the current time, and the computer can determine the current time according to a built-in clock module or a network.
The client can communicate with the service in the service background through a transmission mode such as a network or an optical fiber.
In some embodiments, a service end may be installed in the background, and the service end may communicate with the client, so that the service background may receive, through the service end, a service processing message notified by the client.
The service processing message may include a rejection processing message and a reception processing message, when the service end receives the rejection processing message, the service background installed with the service end may temporarily close its function of receiving the service request, and the service background installed with the service end may not continue to receive the service request of the service until the current time is outside the punishment period.
103. And when the current time is out of the punishment period, informing the target service of receiving the service request.
Similar to step 102, when the service end receives the receiving processing message, the service background installed with the service end can receive a service receiving request of the service.
104. When the target service receives the service request, the request accumulation amount of the target service is determined.
In some embodiments, each time a service request is received by a target service, a request accumulation may be counted, which refers to accumulating the number of service requests it receives.
For example, when the service request is received last time, the request accumulation amount is count, and when the service request is received again, the request accumulation amount is count + 1.
105. And sending the request accumulation amount of the target service to the server so that the server can recalculate the punishment time period of the target service according to the request accumulation amount of the target service.
The client can communicate with the server through the network, after the client sends the request accumulation amount of the target service to the server, the server can recalculate the punishment time period of the target service according to the request accumulation amount and then return the punishment time period to the client, so that the client informs the target service of rejecting the service request in the punishment time period.
In some embodiments, in order to reduce consumption of computing resources and further improve control efficiency of the service processing frequency, the client may further obtain an average configuration frequency of the target service from the server, and transmit the request accumulation amount to the server in divided or whole manner based on the average configuration frequency, and step 105 may include the following steps:
(1) when the request accumulation amount of the target service is not less than the average configuration frequency of the target service, the request accumulation amount of the target service is sent to a server;
(2) when the request accumulation amount of the target service is smaller than the average configuration frequency of the target service, acquiring a preset time interval;
(3) based on a preset time interval, regularly sending the request accumulation amount of the target service to a server;
(4) and clearing the request accumulation amount of the target service.
The average configuration frequency refers to an average configuration frequency for rejecting receiving the service request configured for the target service by the user.
In some embodiments, the client may comprise a plurality of client nodes, and the average configuration frequency may be derived from the user configuration frequency configured by the user for the target service and the number of client nodes.
For example, in some embodiments, average configuration frequency = user configuration frequency/number of client nodes.
In some embodiments, the user configuration frequency may be a Query Per Second (QPS) set by the user for the service, a Query Per Minute (QPM), or the like, and the average configuration frequency may be an average QPS.
Thus, in some embodiments, average QPS = QPS/number of client nodes.
In the embodiment of the present invention, whether the request accumulation amount is accumulated excessively may be determined by an average QPS, and when the request accumulation amount is excessive, the service background needs to process the services quickly.
When the request accumulation amount is too small, the service background does not need to rapidly process the services, so the request accumulation amount can be regularly sent to the server in multiple times in order to reduce the computing resources.
The preset time interval may be set by a technician, for example, the preset time interval may be 0.3 seconds.
For example, when the request accumulation amount count =200, 100 of the request accumulation amounts are transmitted to the server every 0.3 seconds, and at 0.6 seconds, the transmission of all the request accumulation amounts to the server is completed.
Finally, no matter the transmission is performed once or in multiple times, after the transmission is completed, the request accumulation amount needs to be cleared, that is, the count is assigned to 0.
The server may include a plurality of server nodes, that is, the server is a distributed server cluster composed of a plurality of server nodes, and each server node is dedicated to processing the request accumulation amount of its corresponding service.
For example, referring to fig. 2B, service a corresponds to server node a in the server, service B corresponds to server node B in the server, and service C corresponds to server node C in the server.
Each time the client sends the request accumulation amount of the target service to the server, it needs to first determine which server node in the server corresponds to the target service, in order to improve the efficiency of determining the server node, a consistent hash algorithm may be used to implement step (3) and periodically send the request accumulation amount of the target service to the server based on a preset time interval:
mapping the server node on a preset hash ring to obtain a hash ring containing the node;
mapping the target service on a node-containing hash ring to obtain a node service hash ring;
and determining a server node corresponding to the target service on the node service hash ring, and regularly sending the request accumulation amount of the target service to the server node corresponding to the target service.
The consistent hash algorithm is a hash (hash) algorithm, and when one server is removed or added through the consistent hash algorithm, the mapping relation between the existing business service and the corresponding server can be changed as little as possible, so that the requirement of monotonicity is met as much as possible.
The predetermined hash ring may contain 2^32 points equally divided, and referring to FIG. 2c, the point right above the circle represents 0, the first point to the right of 0 represents 1, and so on, 2, 3, 4, 5, 6 … … up to 2^32-1, i.e., the first point to the left of 0 represents 2^ 32-1.
The server nodes a, b, c may be mapped on a preset hash ring. Specifically, hash calculation may be performed on an IP Address (Internet Protocol Address) of a server node, and a result after the hash is used to modulo 2^32, so as to obtain a point corresponding to the server on a hash ring, as follows:
hash (server node IP address)% 2^32
Referring to fig. 2c, the server nodes a, b, and c are mapped on a preset hash ring to obtain a hash ring containing nodes.
Then, hash calculation can be performed on the service name of the target service, and modulo 2^32 is performed by using the hashed result to obtain a corresponding point of the target service on the hash ring, as follows:
hash (name of target service)% 2^32
Referring to fig. 2c, the target service a is mapped on the node-containing hash ring to obtain a node service hash ring.
Then, according to the node service hash ring, the first server node encountered by the target service a in the clockwise direction along the node service hash ring is the server node a, and therefore, the server node a can be determined as the server node corresponding to the target service.
In the method for controlling service processing frequency of a server according to the embodiment of the present invention, the method for controlling service processing frequency may be executed by a processor of the server, as shown in fig. 2a, a specific process of the method for controlling service processing frequency may be as follows:
201. and acquiring the user configuration frequency and determining the number of tokens at the last moment.
The token bucket algorithm is an algorithm for Shaping network Traffic (Traffic Shaping) and Limiting Rate (Rate Limiting), and can prevent network congestion when data is transmitted in a network, limit Traffic flowing out of the network, and enable the Traffic to be sent out at a relatively uniform speed.
The basic process of the token bucket algorithm is as follows:
if the sending rate configured by the user is r, the token bucket can store b tokens at most; adding a token into the token bucket every 1/r second, and if the token bucket is full when the token arrives, discarding the token; when the request accumulation amount count = n arrives, deleting n tokens from the token bucket and informing the client; if the number of tokens stored in the token bucket is less than n, then n tokens will not be deleted and the request accumulation is considered to have not reached the traffic limit.
In the embodiment of the present invention, a token bucket algorithm may be adopted in each server node to calculate a penalty period corresponding to the service of the server node.
For example, referring to fig. 2b, server node a employs token bucket a' to compute a penalty period for traffic service a; the server node B adopts a token bucket B' to calculate the punishment period of the business service B; server node C employs token bucket C' to compute the penalty period for traffic service C.
In step 201, a user configuration frequency set by a user for multiple service services may be obtained, where the user configuration frequency may be a QPS, that is, the user may set different QPSs for different service services.
The last time is the time when the token is put into the token bucket at the last time.
202. The number of tokens at the current time is determined based on the user configured frequency and the number of tokens at the previous time.
As shown in step 101, in order to add tokens into the token bucket periodically, one token may be added into the token bucket at intervals according to a preset token adding time set by a technician.
Since the server includes a plurality of server nodes, the plurality of server nodes includes a server node corresponding to the target service, and the user configuration frequency includes the configuration frequency of the target service, step 202 may include the following steps:
determining a preset token adding time;
and based on the token adding time, summing the user configuration frequency of the target service and the number of tokens of the server node corresponding to the target service at the previous moment to obtain the number of tokens of the server node corresponding to the target service at the current moment.
For example, setting the number of tokens in the token bucket at the previous time as n, the user configuration frequency as r, the token addition amount as 1/r, and the preset token addition time as 1 second, it may be determined that every 1 second passes, and the number of tokens m at the current time is:
m=n+1/r
in some embodiments, the capacity of the token bucket may be set to a user configured frequency, and the same number of tokens as the user configured frequency may be placed into the token bucket per second.
In some embodiments, the user configured frequency may be QPS, the capacity of the token bucket may be set to QPS, and QPS tokens may be put into the token bucket every second.
203. And when the request accumulation amount of the target service is acquired from the client, calculating a punishment period according to the request accumulation amount of the target service and the number of tokens at the current moment.
Each time the server node obtains the request accumulation amount of the target service from the client, the token bucket in the server node deducts a corresponding number of tokens.
Wherein, step 203 may comprise the following steps:
performing difference processing on the number of tokens at the current moment and the request accumulation amount of the target service to obtain the number of tokens at the next moment;
and when the number of the tokens at the next moment is less than 0, calculating a punishment period according to the number of the tokens at the next moment and the number of the tokens at the current moment.
The token number at the next time is the number of tokens remaining in the token bucket after the request accumulation amount is deducted from the token bucket. It should be noted that, since the number of tokens in the token bucket may not be a negative number, when the request accumulation amount is greater than the number of tokens in the token bucket, the portion of the request accumulation amount that cannot be deducted may be referred to as the request remaining amount.
In some embodiments, a penalty period may be calculated from the request residual.
For example, assuming that the request accumulation amount of the target service acquired from the client is count, when the number m of tokens in the token bucket at the current time is less than count, the remaining amount o may be requested:
o=count-m
the penalty period t may be determined by the request residual o and the user configured frequency:
t = o/user configured frequency
For example, if the average configuration frequency is QPS, t = o/QPS.
In some embodiments, since the client may be made up of a number of client nodes, the average configuration frequency is equal to the user configuration frequency/number of client nodes, so for each client, the penalty period t may be determined by the request residual o and the average configuration frequency:
t = o/average configuration frequency
For example, if the average configuration frequency is the average QPS, t = o/average QPS.
In some embodiments, the average configuration frequency may be obtained according to the number of server nodes in the server, so that the method for controlling the service processing frequency of the server may further include the following steps:
determining the number of service nodes in a server;
and calculating the average configuration frequency of the target service based on the number of the service nodes and the configuration frequency of the target service.
In some embodiments, the average configuration frequency of the target service may also be sent to the client, so that the client returns the request accumulation amount of the target service to the service node corresponding to the target service based on the average configuration frequency of the target service.
204. And sending the punishment period to the client so that the client processes the service request of the target service according to the punishment period.
Finally, the server node can send the punishment period to the client so that the client can process the service request of the target service according to the punishment period.
As can be seen from the above, in the embodiment of the present invention, the client counts the request accumulation amount of the target service and sends the request accumulation amount to the server, so that the server calculates the punishment period of the target service according to the request accumulation amount, and after the server sends the punishment period to the client, the client can control the target service to reject the service request within the punishment period, thereby realizing the control of the service request receiving processing frequency, performing peak clipping on the burst traffic, keeping the traffic entering the background stable continuously, and preventing overload and avalanche in the background, and thus, the present scheme can improve the control efficiency of the service processing frequency.
The control scheme of the service processing frequency provided by the embodiment of the invention can be applied to various background service scenes based on cloud computing, for example, a distributed cloud system for controlling the service processing frequency is taken as an example, and the control efficiency of the service processing frequency can be improved by adopting the scheme provided by the embodiment of the invention.
In the embodiment of the invention, the server of the distributed cloud system for controlling the service processing frequency can be a cloud server cluster, the client can be a cloud client cluster, and the cloud server cluster and the cloud client cluster both need to use a cloud technology.
The Cloud technology (Cloud technology) is a hosting technology for unifying series resources such as hardware, software, network and the like in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
The method for controlling the service processing frequency provided by the embodiment of the invention can use the cloud technology to realize a cloud system for controlling the distributed service processing frequency.
For example, referring to fig. 2a, the cloud system for controlling distributed service processing frequency may include a client, a server, a service, a database, and a user configuration platform.
The user may configure various service parameters for different service services on the user configuration platform, where the service parameters may include a service name, a user configuration frequency of the service, such as QPS, and the like.
The user configuration platform can be used for receiving the service parameters configured by the user for various service services and sending the service parameters to the database at regular time, so that the database can send the service parameters to the parameter monitoring interface of the server. The user configuration platform can be used for carrying out different frequency management on different services by a user, and provides differentiated services.
The database can be used for regularly pulling and storing the service parameters from the user configuration platform, so that the database can be used for regularly pulling the service parameters from the user configuration platform; executing a data updating event based on the service parameters so that the server monitors the data updating event through the parameter monitoring interface; sending the service parameters to a parameter monitoring interface of the server so that the server can obtain the service parameters from the database through the parameter monitoring interface;
the server can be provided with a monitoring interface, and the server can determine a parameter monitoring interface; when the database stores the service parameters sent by the user configuration platform, the database can generate an update event of the service parameters, when the server monitors the database through the parameter monitoring interface to generate a data update event, the server can acquire and store the service parameters from the database through the parameter monitoring interface, then acquire the last user configuration frequency, update the last user configuration frequency according to the service parameters to obtain the user configuration frequency, and store the user configuration frequencies of the service services in a local memory for subsequent use.
The service background can install a corresponding service end for each service, the service end can communicate with the client so as to call a control method of service processing frequency in the client, and the service end is used for closing the service receiving function of the target service A when the client informs the target service A that the target service A refuses to receive the service request; and when the client informs the target service A to receive the service request, starting the service receiving function of the target service A. When the service background receives the service request of the target service a, the service background can process the service request a according to the preset service processing operation.
The service background can implement the response to the service request sent by the service foreground according to the preset service processing operation. When a service request enters the service background, the service background can report the service request to the server through the client and then the server performs uniform settlement.
When one service in the service background is accessed to the distributed frequency control cloud system, the service end of the service needs to be reported uniformly.
The client may include a plurality of client nodes, and the client may be configured to:
acquiring T from a server, wherein T is a punishment time period of a target service A;
when the current time is within T, informing the target service A of refusing to receive the service request;
when the current time is out of T, informing the target service A to receive the service request;
when a target service A receives a service request, determining a request accumulation amount count of the target service A;
and sending the request accumulation amount count of the target service A to the server node a, so that the server node a recalculates the punishment period T' of the target service according to the request accumulation amount count of the target service A.
The server can uniformly calculate punishment periods of all business services, so that the real-time performance of flow limitation is improved in a mode of improving the control efficiency of business processing frequency, the server comprises a plurality of distributed server nodes, namely the server is a cloud server cluster, and the server node a can be used for:
acquiring the user configuration frequency of the target service A and determining the number n of tokens at the last moment of the target service At-1
User configuration frequency QPS based on target service and token number n of last time of target servicet-1Determining the number n of tokens at the current time of a target servicet
When the request accumulation amount count of the target service A is obtained from the client, the request accumulation amount count of the target service A and the token number n of the target service A at the current moment are usedtCalculating a punishment period T of the target service;
and sending the punishment period T to the client so that the client can process the service request of the target service A according to the punishment period T.
In some embodiments, in order to prevent abnormal situations such as downtime of a client node in a client, referring to fig. 2a, the client node may notify the server of the received event after knowing that the service receives the service request each time, and pull service parameters of the service from the server at regular time (for example, every 1 minute), such as a service name, the number of nodes of the server node, a QPS, and the like; when the server finds that a certain client node has not reported a receiving event again after a preset time (for example, 5 minutes) is exceeded since the last reporting of the receiving event, the server may determine the client node as an abnormal node, and the server may reallocate a normal client node for the service, and send information such as the QPS and the average QPS to the normal client node again.
In the embodiment of the invention, the client side counts the request accumulation amount of the target service and sends the request accumulation amount to the server, so that the server calculates the punishment time period of the target service according to the request accumulation amount, and after the server sends the punishment time period to the client side, the client side can control the target service to reject the service request in the punishment time period, thereby realizing the control of the service receiving and processing frequency of the service request, and preventing the target service from generating safety problems such as abnormal service, downtime and the like due to excessive application amount.
Referring to fig. 2d, the user may further set a starting time and an ending time of the control method for the service processing frequency on the user configuration platform, and the request received by the service is matched with the QPS set by the user from the frequency regulation starting time to the frequency ending time, and may be stably fluctuated in a small range, and maintained at a safe level. Therefore, the scheme can improve the control efficiency of the business processing frequency, thereby improving the control efficiency of the business processing frequency.
In order to better implement the above method, an embodiment of the present invention further provides a control device for service processing frequency, where the control device for service processing frequency may be specifically integrated in an electronic device, and the electronic device may be a terminal, a server, or other devices. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
For example, in this embodiment, a method according to an embodiment of the present invention will be described in detail by taking an example in which a control device suitable for a service processing frequency of a client is specifically integrated in a server.
For example, as shown in fig. 3a, the control device for the service processing frequency may include a penalty obtaining unit 301, a rejecting unit 302, a receiving unit 303, an accumulation unit 304, and an accumulation transmitting unit 305, as follows:
penalty acquiring unit 301:
penalty acquisition unit 301 may be configured to acquire a penalty period for the target service from the server.
The second reject unit 302:
the rejection unit 302 may be configured to inform the target service to reject receiving the service request when the current time is within the penalty period.
(iii) the receiving unit 303:
the receiving unit 303 may be configured to notify the target service to receive the service request when the current time is outside the penalty period.
(iv) accumulation amount unit 304:
the accumulation unit 304 may be configured to determine a requested accumulation amount for the target service when the target service receives a service request.
(v) accumulation amount transmitting section 305:
the accumulation amount sending unit 305 may be configured to send the request accumulation amount of the target service to the server, so that the server recalculates the penalty period of the target service according to the request accumulation amount of the target service.
In some embodiments, the client may comprise a plurality of client nodes, and the control means adapted to the traffic handling frequency of the client may be further adapted to:
and acquiring the average configuration frequency of the target service from the server.
At this time, referring to fig. 3b, in some embodiments, the accumulation amount transmission unit 305 may include an accumulation amount transmission sub-unit 3051, an interval sub-unit 3052, a timing transmission sub-unit 3053, and a clear sub-unit 3054, as follows:
(1) accumulation amount transmitting subunit 3051:
the accumulation amount transmitting subunit 3051 may be configured to transmit the request accumulation amount of the target service to the server when the request accumulation amount of the target service is not less than the average configuration frequency of the target service.
(2) Spacer unit 3052:
the interval subunit 3052 may be configured to obtain the preset time interval when the request accumulation amount of the target service is smaller than the average configuration frequency of the target service.
(3) Timing transmission subunit 3053:
the timing transmission sub-unit 3053 may be configured to transmit the request accumulation amount of the target service to the server at a timing based on a preset time interval.
(4) Zero clearing subunit 3054:
the clear subunit 3054 may be configured to perform clear processing on the request accumulation amount of the target service.
In some embodiments, the server may include a plurality of server nodes, and the timing transmission subunit 3053 may be configured to:
mapping the server node on a preset hash ring to obtain a hash ring containing the node;
mapping the target service on a node-containing hash ring to obtain a node service hash ring;
and determining a server node corresponding to the target service on the node service hash ring, and regularly sending the request accumulation amount of the target service to the server node corresponding to the target service.
In addition, in this embodiment, a method according to an embodiment of the present invention will be described in detail by taking an example in which a control device suitable for a service processing frequency of a server is specifically integrated in a distributed cloud server cluster composed of a plurality of servers.
For example, as shown in fig. 4, the control device of the service processing frequency may include a configuration unit 401, a token unit 402, and the following:
configuration unit 401:
the configuration unit 401 may be configured to obtain a user configuration frequency of the target service and determine the number of tokens at the last time of the target service.
Token 402:
the token unit 402 may be configured to determine the number of tokens at the current time of the target service based on the user configured frequency of the target service and the number of tokens at the last time of the target service.
In some embodiments, the server may include a plurality of server nodes, the plurality of server nodes may include a server node corresponding to the target service, the user configuration frequency may include a configuration frequency of the target service, and the token 402 may be configured to:
determining a preset token adding time;
and based on the token adding time, summing the user configuration frequency of the target service and the number of tokens of the server node corresponding to the target service at the previous moment to obtain the number of tokens of the server node corresponding to the target service at the current moment.
(III) penalty calculation unit 403:
the penalty calculation unit 403 may be configured to calculate a penalty period of the target service according to the request accumulation amount of the target service and the number of tokens of the target service at the current time when the request accumulation amount of the target service is acquired from the client.
In some embodiments, penalty calculation unit 403 may be configured to:
performing difference processing on the number of tokens at the current moment and the request accumulation amount of the target service to obtain the number of tokens at the next moment;
and when the number of the tokens at the next moment is less than 0, calculating a punishment period according to the number of the tokens at the next moment and the number of the tokens at the current moment.
(IV) penalty transmission unit 404:
the penalty sending unit 404 may be configured to send the penalty period to the client, so that the client processes the service request of the target service according to the penalty period.
In some embodiments, the server may include a plurality of service nodes, and the control device of the traffic processing frequency may be further configured to:
determining the number of service nodes in a server;
calculating the average configuration frequency of the target service based on the number of the service nodes and the configuration frequency of the target service;
and sending the average configuration frequency of the target service to the client so that the client returns the request accumulation amount of the target service to the service node corresponding to the target service based on the average configuration frequency of the target service.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
As can be seen from the above, in the control device for service processing frequency applicable to the client according to this embodiment, the penalty obtaining unit obtains the penalty period of the target service from the server; when the current time is within the punishment time period, the rejection unit informs the target service of rejecting to receive the service request; when the current time is out of the punishment period, the receiving unit informs the target service of receiving the service request; when a target service receives a service request, an accumulation unit determines the request accumulation amount of the target service; and the accumulation sending unit sends the request accumulation of the target service to the server so that the server can recalculate the punishment period of the target service according to the request accumulation of the target service.
In the control device of the service processing frequency applicable to the server in this embodiment, the configuration unit acquires the user configuration frequency of the target service and determines the number of tokens of the target service at the previous time; determining the token number of the target service at the current moment by the token unit based on the user configuration frequency of the target service and the token number of the target service at the last moment; when the request accumulation amount of the target service is obtained from the client, a punishment calculation unit calculates a punishment period of the target service according to the request accumulation amount of the target service and the token number of the target service at the current moment; and the punishment sending unit sends the punishment period to the client so that the client can process the service request of the target service according to the punishment period.
Therefore, the embodiment of the invention can improve the control efficiency of the service processing frequency.
The embodiment of the invention also provides the electronic equipment which can be equipment such as a terminal, a server and the like. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and the like; the server may be a single server, a server cluster composed of a plurality of servers, or the like.
In some embodiments, the control device of the service processing frequency may also be integrated in a plurality of electronic devices, for example, the control device of the service processing frequency may be integrated in a plurality of servers, and the plurality of servers implement the control method of the service processing frequency of the present invention.
In some embodiments, the control device of the traffic processing frequency may be further integrated in a distributed cloud server cluster composed of a plurality of cloud servers.
In this embodiment, a detailed description will be given by taking an example that the electronic device of this embodiment is a distributed cloud server cluster formed by a plurality of servers, for example, as shown in fig. 5, which shows a schematic structural diagram of each server according to an embodiment of the present invention, specifically:
the server may include components such as a processor 501 of one or more processing cores, memory 502 of one or more computer-readable storage media, a power supply 503, an input module 504, and a communication module 505. Those skilled in the art will appreciate that the server architecture shown in FIG. 5 is not meant to be limiting, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 501 is a control center of the server, connects various parts of the entire server by various interfaces and lines, and performs various functions of the server and processes data by running or executing software programs and/or modules stored in the memory 502 and calling data stored in the memory 502, thereby performing overall monitoring of the server. In some embodiments, processor 501 may include one or more processing cores; in some embodiments, processor 501 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 501.
The memory 502 may be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by operating the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to the use of the server, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
The server also includes a power supply 503 for supplying power to the various components, and in some embodiments, the power supply 503 may be logically connected to the processor 501 through a power management system, so that the functions of managing charging, discharging, and power consumption are implemented through the power management system. The power supply 503 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The server may also include an input module 504, the input module 504 operable to receive entered numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
The server may also include a communication module 505, and in some embodiments the communication module 505 may include a wireless module by which the server may wirelessly transmit over short distances to provide wireless broadband internet access to the user. For example, the communication module 505 can be used to assist a user in emailing, browsing web pages, accessing streaming media, and the like.
Although not shown, the server may further include a display unit and the like, which will not be described in detail herein.
In some embodiments, the processor 501 in the server may load the executable file corresponding to the process of one or more applications into the memory 502 according to the following instructions, and the processor 501 executes the applications stored in the memory 502, so as to implement various functions, as follows:
obtaining a punishment period of the target service from a server;
when the current time is within the punishment time period, informing the target service of refusing to receive the service request;
when the current time is out of the punishment period, informing the target service of receiving the service request;
when a target service receives a service request, determining the request accumulation amount of the target service;
and sending the request accumulation amount of the target service to the server so that the server can recalculate the punishment time period of the target service according to the request accumulation amount of the target service.
In some embodiments, the processor 501 in the server may load the executable file corresponding to the process of one or more applications into the memory 502 according to the following instructions, and the processor 501 executes the applications stored in the memory 502, so as to implement various functions, as follows:
acquiring user configuration frequency and determining the number of tokens at the last moment;
determining the number of tokens at the current moment based on the user configuration frequency and the number of tokens at the previous moment;
when the request accumulation amount of the target service is acquired from the client, calculating a punishment period according to the request accumulation amount of the target service and the number of tokens at the current moment;
and sending the punishment period to the client so that the client processes the service request of the target service according to the punishment period. The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Therefore, the scheme can improve the control efficiency of the service processing frequency.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present invention provides a computer-readable storage medium, in which a plurality of instructions are stored, where the instructions can be loaded by a processor to execute steps in any one of the methods for controlling a service processing frequency provided by the embodiments of the present invention. For example, in some embodiments, the instructions may perform the steps of:
obtaining a punishment period of the target service from a server;
when the current time is within the punishment time period, informing the target service of refusing to receive the service request;
when the current time is out of the punishment period, informing the target service of receiving the service request;
when a target service receives a service request, determining the request accumulation amount of the target service;
and sending the request accumulation amount of the target service to the server so that the server can recalculate the punishment time period of the target service according to the request accumulation amount of the target service.
In some embodiments, the instructions may perform the steps of:
acquiring user configuration frequency and determining the number of tokens at the last moment;
determining the number of tokens at the current moment based on the user configuration frequency and the number of tokens at the previous moment;
when the request accumulation amount of the target service is acquired from the client, calculating a punishment period according to the request accumulation amount of the target service and the number of tokens at the current moment;
and sending the punishment period to the client so that the client processes the service request of the target service according to the punishment period.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in the various optional implementations of the aspect of controlling the service processing frequency or the aspect of the distributed frequency control cloud system provided in the above embodiments.
Since the instructions stored in the storage medium may execute the steps in any service processing frequency control method provided in the embodiment of the present invention, beneficial effects that can be achieved by any service processing frequency control method provided in the embodiment of the present invention can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The method, the apparatus, the server and the computer-readable storage medium for controlling the service processing frequency provided by the embodiments of the present invention are described in detail above, and a specific example is applied in the present disclosure to explain the principle and the implementation of the present invention, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (15)

1. A method for controlling service processing frequency is applicable to a client, and comprises the following steps:
obtaining a punishment period and an average configuration frequency of a target service from a server;
when the current time is within the punishment time period, informing the target service of refusing to receive the service request;
when the current time is out of the punishment period, informing the target service of receiving a service request;
when the target service receives a service request, determining the request accumulation amount of the target service;
and sending the request accumulation amount of the target service to the server based on the average configuration frequency of the target service, so that the server can recalculate the punishment period of the target service according to the request accumulation amount of the target service.
2. The method for controlling service processing frequency according to claim 1, wherein the client includes a plurality of client nodes, and the sending the request accumulation amount of the target service to the server based on the average configured frequency of the target service includes:
when the request accumulation amount of the target service is not less than the average configuration frequency of the target service, sending the request accumulation amount of the target service to the server;
when the request accumulation amount of the target service is smaller than the average configuration frequency of the target service, acquiring a preset time interval;
based on the preset time interval, regularly sending the request accumulation amount of the target service to the server;
and clearing the request accumulation amount of the target service.
3. The method for controlling service processing frequency according to claim 2, wherein the server includes a plurality of server nodes, and the timing of sending the request accumulation amount of the target service to the server based on the preset time interval includes:
mapping the server node on a preset hash ring to obtain a hash ring containing the node;
mapping the target service on the node-containing hash ring to obtain a node service hash ring;
and determining a server node corresponding to the target service on the node service hash ring, and sending the request accumulation amount of the target service to the server node corresponding to the target service at regular time.
4. A method for controlling service processing frequency is applicable to a server, and comprises the following steps:
acquiring user configuration frequency and determining the number of tokens at the last moment, wherein the user configuration frequency comprises the configuration frequency of a target service;
calculating the average configuration frequency of the target service based on the configuration frequency of the target service, and sending the average configuration frequency of the target service to a client;
determining the number of tokens at the current moment based on the user configuration frequency and the number of tokens at the previous moment;
when the request accumulation amount of the target service is acquired from a client, calculating a punishment period according to the request accumulation amount of the target service and the token number at the current moment;
and sending the punishment time interval to a client so that the client can process the service request of the target service according to the punishment time interval.
5. The method for controlling service processing frequency according to claim 4, wherein the server includes a plurality of server nodes, the plurality of server nodes includes a server node corresponding to the target service, and the determining the number of tokens at the current time based on the user configuration frequency and the number of tokens at the previous time includes:
determining a preset token adding time;
and summing the user configuration frequency of the target service and the number of tokens of the server node corresponding to the target service at the previous moment based on the token adding time to obtain the number of tokens of the server node corresponding to the target service at the current moment.
6. The method for controlling service processing frequency according to claim 4, wherein said calculating a penalty period according to the request accumulation amount of the target service and the number of tokens at the current time comprises:
performing difference processing on the number of tokens at the current moment and the request accumulation amount of the target service to obtain the number of tokens at the next moment;
and when the number of the tokens at the next moment is less than 0, calculating a punishment time period according to the number of the tokens at the next moment and the number of the tokens at the current moment.
7. The method for controlling service processing frequency according to claim 4, wherein the server includes a plurality of service nodes, and the calculating the average configuration frequency of the target service based on the configuration frequency of the target service and sending the average configuration frequency of the target service to the client includes:
determining the number of service nodes in the server;
calculating the average configuration frequency of the target service based on the number of the service nodes and the configuration frequency of the target service;
and sending the average configuration frequency of the target service to a client so that the client returns the request accumulation amount of the target service to a service node corresponding to the target service based on the average configuration frequency of the target service.
8. A system for controlling frequency of traffic processing, comprising a client and a server, the client communicating with the server, wherein:
the client is used for:
obtaining a punishment period and an average configuration frequency of a target service from a server;
when the current time is within the punishment time period, informing the target service of refusing to receive the service request;
when the current time is out of the punishment period, informing the target service of receiving a service request;
when the target service receives a service request, determining the request accumulation amount of the target service;
sending the request accumulation amount of the target service to the server based on the average configuration frequency of the target service, so that the server can recalculate the punishment time period of the target service according to the request accumulation amount of the target service;
the server is configured to:
acquiring user configuration frequency of the target service, and determining the number of tokens of the target service at the last moment, wherein the user configuration frequency comprises the configuration frequency of the target service;
calculating the average configuration frequency of the target service based on the configuration frequency of the target service, and sending the average configuration frequency of the target service to a client;
determining the token number of the target service at the current moment based on the user configuration frequency of the target service and the token number of the target service at the last moment;
when the request accumulation amount of the target service is acquired from the client, calculating a punishment period of the target service according to the request accumulation amount of the target service and the token number of the target service at the current moment;
and sending the punishment time interval to a client so that the client can process the service request of the target service according to the punishment time interval.
9. The system for controlling service processing frequency according to claim 8, wherein the system for controlling service processing frequency further comprises a service end, the service end runs at least one service, the service end invokes a client through a network, and the service end is configured to:
when the client informs the target service that the service request is refused to be received, the service receiving function of the target service is closed;
when the client informs the target service to receive the service request, the service receiving function of the target service is started;
and when receiving the service request of the target service, processing the service request according to preset service processing operation.
10. The system for controlling service processing frequency according to claim 8, wherein the system for controlling service processing frequency further comprises a database, and the server, when being configured to obtain the user configuration frequency, is specifically configured to:
determining a parameter monitoring interface;
when a data updating event of the database is monitored through the parameter monitoring interface, acquiring service parameters from the database through the parameter monitoring interface;
acquiring the last user configuration frequency;
and updating the last user configuration frequency according to the service parameters to obtain the user configuration frequency.
11. The system for controlling service processing frequency according to claim 10, wherein said system for controlling service processing frequency further comprises a user configuration platform, said database for:
pulling service parameters from the user configuration platform at regular time;
executing a data updating event based on the service parameter so that the server monitors the data updating event through the parameter monitoring interface;
sending the service parameters to a parameter monitoring interface of the server so that the server can acquire the service parameters from the database through the parameter monitoring interface;
the user configuration platform is configured to:
receiving service parameters configured by a user for a target service;
and sending the service parameters to the database at regular time so that the database can send the service parameters to a parameter monitoring interface of the server.
12. A control device for service processing frequency, adapted to a client, comprising:
the punishment obtaining unit is used for obtaining the punishment time period and the average configuration frequency of the target service from the server;
the rejection unit is used for informing the target service of rejecting and receiving the service request when the current moment is within the punishment time interval;
a receiving unit, configured to notify the target service of receiving a service request when the current time is outside the penalty period;
an accumulation unit, configured to determine a request accumulation amount of the target service when the target service receives a service request;
and the accumulation sending unit is used for sending the request accumulation of the target service to the server based on the average configuration frequency of the target service so that the server can recalculate the punishment period of the target service according to the request accumulation of the target service.
13. A control device for service processing frequency, adapted to a server, comprising:
the configuration unit is used for acquiring the user configuration frequency of the target service, determining the number of tokens at the last moment of the target service, calculating the average configuration frequency of the target service based on the configuration frequency of the target service, and sending the average configuration frequency of the target service to the client, wherein the user configuration frequency comprises the configuration frequency of the target service;
the token unit is used for determining the token number of the target service at the current moment based on the user configuration frequency of the target service and the token number of the target service at the last moment;
the penalty calculation unit is used for calculating a penalty period of the target service according to the request accumulation amount of the target service and the token number of the target service at the current moment when the request accumulation amount of the target service is acquired from a client;
and the punishment sending unit is used for sending the punishment time interval to the client so that the client can process the service request of the target service according to the punishment time interval.
14. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to execute the steps of the method for controlling the service processing frequency according to any one of claims 1 to 7.
15. A computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the method for controlling service processing frequency according to any one of claims 1 to 7.
CN202011045773.3A 2020-09-29 2020-09-29 Method, system and device for controlling service processing frequency and electronic equipment Active CN111897659B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011045773.3A CN111897659B (en) 2020-09-29 2020-09-29 Method, system and device for controlling service processing frequency and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011045773.3A CN111897659B (en) 2020-09-29 2020-09-29 Method, system and device for controlling service processing frequency and electronic equipment

Publications (2)

Publication Number Publication Date
CN111897659A CN111897659A (en) 2020-11-06
CN111897659B true CN111897659B (en) 2020-12-25

Family

ID=73223996

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011045773.3A Active CN111897659B (en) 2020-09-29 2020-09-29 Method, system and device for controlling service processing frequency and electronic equipment

Country Status (1)

Country Link
CN (1) CN111897659B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282902B (en) * 2021-07-26 2022-03-08 南京蓝鲸人网络科技有限公司 Business behavior safety control method, system and equipment
CN114125029A (en) * 2021-11-29 2022-03-01 深圳十方融海科技有限公司 Request processing method, device, equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10764185B2 (en) * 2013-06-25 2020-09-01 Amazon Technologies, Inc. Token-based policies burst-mode operations

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080162707A1 (en) * 2006-12-28 2008-07-03 Microsoft Corporation Time Based Permissioning
EP2042991A1 (en) * 2007-09-25 2009-04-01 GEMALTO Pte Ltd Method of detecting abnormal use of a non volatile memory
US9647950B2 (en) * 2015-05-11 2017-05-09 Ebay Inc. System and method of site traffic control
US10834230B2 (en) * 2017-08-25 2020-11-10 International Business Machines Corporation Server request management
CN108011840A (en) * 2017-12-07 2018-05-08 中国银行股份有限公司 Control method, server and the system of transaction request
CN110932988A (en) * 2019-10-31 2020-03-27 北京三快在线科技有限公司 Flow control method and device, electronic equipment and readable storage medium
CN111614570B (en) * 2020-04-20 2022-07-01 北京邮电大学 Flow control system and method for service grid

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10764185B2 (en) * 2013-06-25 2020-09-01 Amazon Technologies, Inc. Token-based policies burst-mode operations

Also Published As

Publication number Publication date
CN111897659A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
CN110198275B (en) Flow control method, system, server and storage medium
CN108494703B (en) Access frequency control method, device and storage medium
CN110049130B (en) Service deployment and task scheduling method and device based on edge computing
US11032210B2 (en) Software load balancer to maximize utilization
CN111897659B (en) Method, system and device for controlling service processing frequency and electronic equipment
EP3264723B1 (en) Method, related apparatus and system for processing service request
WO2017016113A1 (en) Method and device for monitoring network traffic
CN112165691A (en) Content delivery network scheduling method, device, server and medium
CN101778105B (en) Method, system and equipment for obtaining real-time performance monitoring indicated numbers based on WEB
CN111726303A (en) Flow control method and device and computing equipment
JP2022549055A (en) NODE RATE LIMITING METHOD, APPARATUS, ELECTRONIC DEVICE AND STORAGE MEDIUM
CN115277577B (en) Data processing method, apparatus, computer device, and computer readable storage medium
WO2024012065A1 (en) Data transmission control method and apparatus, computer-readable storage medium, computer device, and computer program product
US20160294569A1 (en) Quota control policy
CN113328906B (en) Flow real-time monitoring method and device, storage medium and electronic equipment
CN102137091A (en) Overload control method, device and system as well as client-side
JP2001202318A (en) Data distribution system
CN105376170A (en) Load balance-preferred virtual network function combination method
CN114978998B (en) Flow control method, device, terminal and storage medium
WO2021018058A1 (en) System overload control method and device
CN114896296A (en) Cloud service resource configuration method and device, electronic equipment and computer readable medium
CN112165495B (en) DDoS attack prevention method and device based on super-fusion architecture and super-fusion cluster
CN111193760B (en) Information sending method, device and storage medium
CN113992586A (en) Flow control method and device, computer equipment and storage medium
CN107707383B (en) Put-through processing method and device, first network element and second network element

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