CN112256432A - Service overload processing method and device, electronic equipment and storage medium - Google Patents

Service overload processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112256432A
CN112256432A CN202011182370.3A CN202011182370A CN112256432A CN 112256432 A CN112256432 A CN 112256432A CN 202011182370 A CN202011182370 A CN 202011182370A CN 112256432 A CN112256432 A CN 112256432A
Authority
CN
China
Prior art keywords
service request
current
service
request threshold
threshold value
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
CN202011182370.3A
Other languages
Chinese (zh)
Inventor
曹福祥
王玉龙
魏诗白
张子博
谭文杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202011182370.3A priority Critical patent/CN112256432A/en
Publication of CN112256432A publication Critical patent/CN112256432A/en
Pending legal-status Critical Current

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/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
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • 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/5022Workload threshold

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)

Abstract

The method comprises the steps of obtaining resource data of a system and current load information of the system at the current moment, calculating a service request threshold value of the system at the next moment according to the size relation between the resource data and the current load information, carrying out corresponding service calling according to a service calling request if the number of concurrent service requests of the system is less than the service request threshold value when the system receives the service calling request at the next moment, and discarding the service calling request if the number of concurrent service requests of the system is more than or equal to the service request threshold value. Therefore, dynamic adjustment of the service request threshold is realized, the problem that the accuracy of manually setting the service request threshold is not high is solved, and based on the dynamic service request threshold, the system can be guaranteed to tolerate timely burst flow spikes and can be guaranteed to provide services to the maximum extent under the condition that the processing capacity of the system is not exceeded.

Description

Service overload processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method and an apparatus for processing service overload, an electronic device, and a storage medium.
Background
RPC (Remote Procedure Call Protocol) refers to Remote communication and mutual calls between different systems in a distributed system architecture, where the calls between different systems include calls between services in different systems.
If a system receives too many RPC requests, which exceed its processing capability, overload will occur. For this system, overload protection is generally performed by means of a threshold value, however, at present, in an overload protection mechanism, the threshold value generally needs to be set by human experience, but if the threshold value is set too large, the overload protection effect is not achieved, and if the threshold value is set too small, the sensitivity is too high, so that the RPC request under the short-time burst traffic spike is mistakenly discarded. Therefore, in the current overload protection mechanism, how to set a reasonable threshold is crucial.
Disclosure of Invention
The present disclosure provides a method and an apparatus for processing service overload, an electronic device, and a storage medium, so as to at least solve the problem of how to reasonably set a threshold in an overload protection mechanism in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a method for processing service overload, the method including:
acquiring resource data of a system providing services in a distributed system architecture and current load information of the system at the current moment, and calculating a service request threshold value of the system at the next moment according to the magnitude relation between the resource data and the current load information;
when the system receives a service calling request at the next moment, if the number of concurrent service requests of the system is smaller than the service request threshold value, corresponding service calling is carried out according to the service calling request;
and if the number of the concurrent service requests of the system is greater than or equal to the service request threshold value, discarding the service call request.
In one embodiment, the resource data of the system comprises the number of CPU cores of the system, and the current load information of the system at the current moment comprises the number of tasks currently executed by the system; the acquiring resource data of a system and current load information of the system at the current moment, and calculating a service request threshold of the system at the next moment according to a size relationship between the resource data and the current load information, comprises: if the number of tasks currently executed by the system is larger than the number of CPU cores of the system, reducing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; if the number of tasks currently executed by the system is smaller than the number of CPU cores of the system, increasing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; and if the number of the tasks currently executed by the system is equal to the number of the CPU cores of the system, taking the current service request threshold value of the system at the current moment as the service request threshold value of the system at the next moment.
In one embodiment, calculating the service request threshold of the system at the next time according to the magnitude relationship between the resource data and the current load information includes: acquiring the current concurrent service request number and the current service request threshold value of the system at the current moment; calculating a first estimation value of a service request threshold value of the system at the next moment according to a first set value, resource data of the system, current load information of the system at the current moment and the current service request threshold value, wherein the first set value is used for representing a learning rate in a gradient descent algorithm and is used for calculating and limiting the size of the first estimation value; calculating a second estimation value of a service request threshold value of the system at the next moment according to a second set value and the current concurrent service request number of the system at the current moment, wherein the second set value is used for representing the expansion and contraction rate in a gradient descent algorithm and is used for calculating and limiting the size of the second estimation value; and extracting the minimum value of the first estimation value and the second estimation value of the service request threshold value of the system at the next moment, and taking the minimum value as the service request threshold value of the system at the next moment.
In one embodiment, calculating a first estimated value of the service request threshold of the system at the next time according to the first set value and the resource data of the system, the current load information of the system at the current time and the current service request threshold comprises: acquiring a difference value between the resource data of the system and the current load information of the system at the current moment; extracting a quotient between the difference value and the current load information of the system at the current moment; obtaining the product of the quotient, the first set value and the current service request threshold value of the system at the current moment to obtain the offset of the service request threshold value of the system at the next moment; and acquiring the sum of the current service request threshold value of the system at the current moment and the offset of the service request threshold value of the system at the next moment, and determining the sum as a first estimated value of the service request threshold value of the system at the next moment.
In one embodiment, calculating a second estimated value of the service request threshold of the system at the next time according to a second set value and the current number of concurrent service requests of the system at the current time comprises: and obtaining the product of the current concurrent service request number of the system at the current moment and the second set value, and determining the product as a second estimated value of the service request threshold value of the system at the next moment.
In one embodiment, the first set point is in the interval of [0,1), and the second set point is greater than 1.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for processing a service overload, the apparatus including:
the system comprises a data acquisition module, a data acquisition module and a data processing module, wherein the data acquisition module is configured to acquire resource data of a system providing services in a distributed system architecture and current load information of the system at the current moment;
a threshold estimation module configured to calculate a service request threshold of the system at a next moment according to a magnitude relation between the resource data and current load information;
the service processing module is configured to execute corresponding service calling according to the service calling request if the number of concurrent service requests of the system is smaller than the service request threshold when the system receives the service calling request at the next moment; and if the number of the concurrent service requests of the system is greater than or equal to the service request threshold value, discarding the service call request.
In one embodiment, the resource data of the system comprises the number of CPU cores of the system, and the current load information of the system at the current moment comprises the number of tasks currently executed by the system; the threshold estimation module is configured to perform: if the number of tasks currently executed by the system is larger than the number of CPU cores of the system, reducing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; if the number of tasks currently executed by the system is smaller than the number of CPU cores of the system, increasing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; and if the number of the tasks currently executed by the system is equal to the number of the CPU cores of the system, taking the current service request threshold value of the system at the current moment as the service request threshold value of the system at the next moment.
In one embodiment, the threshold estimation module comprises: the data acquisition unit is configured to acquire the current concurrent service request number and the current service request threshold value of the system at the current moment; a first estimated value obtaining unit configured to perform calculation of a first estimated value of a service request threshold of the system at a next time, based on a first set value and resource data of the system, current load information of the system at the current time, and a current service request threshold, the first set value being used to characterize a learning rate in a gradient descent algorithm, and being used to calculate and define a magnitude of the first estimated value; a second estimated value obtaining unit, configured to calculate a second estimated value of a service request threshold of the system at a next moment according to a second set value and a current concurrent service request number of the system at a current moment, wherein the second set value is used for representing a telescopic rate in a gradient descent algorithm and is used for calculating and limiting the size of the second estimated value; and the service request threshold acquisition unit is configured to extract the minimum value of the first estimation value and the second estimation value of the service request threshold of the system at the next moment, and the minimum value is used as the service request threshold of the system at the next moment.
In one embodiment, the first estimated value obtaining unit is configured to perform: acquiring a difference value between the resource data of the system and the current load information of the system at the current moment; extracting a quotient between the difference value and the current load information of the system at the current moment; obtaining the product of the quotient, the first set value and the current service request threshold value of the system at the current moment to obtain the offset of the service request threshold value of the system at the next moment; and acquiring the sum of the current service request threshold value of the system at the current moment and the offset of the service request threshold value of the system at the next moment, and determining the sum as a first estimated value of the service request threshold value of the system at the next moment.
In one embodiment, the second estimated value obtaining unit is configured to perform: and obtaining the product of the current concurrent service request number of the system at the current moment and the second set value, and determining the product as a second estimated value of the service request threshold value of the system at the next moment.
In one embodiment, the first set point is in the interval of [0,1), and the second set point is greater than 1.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to cause the electronic device to perform the method for handling service overload described in any embodiment of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, wherein instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the method for handling service overload described in any one of the embodiments of the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, the program product comprising a computer program, the computer program being stored in a readable storage medium, from which at least one processor of a device reads and executes the computer program, so that the device performs the method of handling a service overload described in any one of the embodiments of the first aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the method comprises the steps of calculating a service request threshold value of a system at the next moment by acquiring resource data of the system and current load information of the system at the current moment and according to the size relation between the resource data and the current load information, carrying out corresponding service calling according to a service calling request if the number of concurrent service requests of the system is smaller than the service request threshold value when the service calling request is received at the next moment, and discarding the service calling request if the number of concurrent service requests of the system is larger than or equal to the service request threshold value. Therefore, dynamic adjustment of the service request threshold is realized, the problem that the accuracy of manually setting the service request threshold is not high is solved, and based on the dynamic service request threshold, the system can be guaranteed to tolerate timely burst flow spikes and can be guaranteed to provide services to the maximum extent under the condition that the processing capacity of the system is not exceeded.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 is a flow chart illustrating a method of handling a service overload according to an example embodiment.
Fig. 2 is a flowchart illustrating the step of estimating a service request threshold according to an example embodiment.
Fig. 3 is a block diagram illustrating a service overload processing apparatus according to an example embodiment.
Fig. 4 is an internal block diagram of an electronic device shown in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
To facilitate understanding of a method for handling service overload provided by the present disclosure, RPC will be briefly described below. RPC is remote communication and mutual invocation between different systems in a distributed system architecture, and specifically, between different systems in the distributed system architecture, a service running in each system may request to invoke a service running in another system through RPC. However, when a system receives too many RPC requests, which exceed its processing capability, overload may occur. For the system, when overload occurs, RPC requests which cannot be processed in time enter a queuing state, if the overload condition is continuous, the queuing queue becomes longer and longer, and finally all RPC requests cannot be processed in time. Therefore, when overload occurs, an overload protection mechanism is usually activated, that is, a part of RPC requests are discarded (rejected), and other RPC requests are guaranteed to be processed in time, so that the system can still provide a certain service capability. At present, a common practice in an overload protection mechanism is to set a threshold value for processing the number of RPC requests by a system, count the current number of RPC concurrent requests when the system receives one RPC request, and if the current number of RPC concurrent requests reaches the threshold value, indicate that the system is overloaded, thereby discarding the RPC request. While system overload generally means that some resource of the system is insufficient, for example, the resource of a Central Processing Unit (CPU) of the system is insufficient, and whether the CPU is overloaded or not can be measured by the CPU load. But the processing power is usually different for different systems. At present, the mode of setting the threshold value by the experience of people has large workload, and the threshold value suitable for the system is difficult to accurately set, if the threshold value is set too large, the effect of overload protection on the system cannot be achieved, and if the threshold value is set too small, the system is too sensitive, so that the RPC request under the short burst flow spike is mistakenly discarded.
Based on this, the present disclosure provides a method for processing service overload, as shown in fig. 1, including the following steps.
In step S110, resource data of a system providing a service in the distributed system architecture and current load information of the system at the current time are obtained.
The resource data comprises CPU resources of the system, a system memory, a network card transmission rate and the like, the CPU resources can be measured by the number of CPU cores, the number of CPU cores is that the CPU is composed of a plurality of cores, and the more the number of cores is, the faster the running speed of the CPU is represented, and the better the performance is. For example, for the same data processing, one-core CPU is equivalent to 1 person processing data, a dual-core CPU is equivalent to 2 persons processing the same data, and a 4-core CPU is equivalent to 4 persons processing the same data, so that the more the number of processing cores is, the higher the working efficiency of the CPU is. The system memory refers to the memory capacity of the system. Because the resource bottleneck of the system memory or the network card transmission rate is relatively easy to solve, for example, the memory can be controlled as long as the used capacity does not exceed the memory capacity, and the control of the network card transmission rate is similar to the system memory. Therefore, when determining whether the system is overloaded, in most cases, only the CPU resources of the system need to be considered. And whether the CPU is overloaded or not can be measured by the CPU load, which represents how many threads are currently Running, that is, the current load information of the system at the current time. If the running thread number of the system at a certain time exceeds the CPU core number, the CPU is busy, namely the CPU is overloaded. Therefore, in this embodiment, the processing of overload protection is performed by acquiring the resource data of the system and the current load information of the system at the current time and performing the subsequent steps.
In step S120, a service request threshold of the system at the next time is calculated according to the magnitude relationship between the resource data and the current load information.
Wherein the service request threshold is the maximum number of concurrent RPC requests that the system can handle at a certain time, which is set based on the overload protection mechanism. The size relationship between the resource data and the current load information may refer to a mutual size relationship between the resource data and the current load information. For example, in the overload protection mechanism, when the CPU of the system is overloaded at a certain time, it means that the running thread number of the system exceeds (i.e. is greater than) the CPU core number at that time, so that the service request threshold of the system needs to be made small enough to discard enough requests, and the remaining requests are guaranteed not to exceed the processing capacity of the system. Under normal conditions, that is, the running thread number of the system does not exceed (i.e., is less than or equal to) the core number of the CPU, it indicates that the CPU of the system is not overloaded, and at this time, the service request threshold of the system needs to be made large enough to ensure that the system can tolerate a timely burst traffic spike. Based on this, in this embodiment, the service request threshold of the system at the next time is calculated according to the magnitude relationship between the resource data of the system and the current load information, so as to implement dynamic adjustment of the service request threshold.
In step S130, when the system receives a service invocation request at the next time, if the number of concurrent service requests of the system is less than the service request threshold, corresponding service invocation is performed according to the service invocation request.
In step S140, if the number of concurrent service requests of the system is greater than or equal to the service request threshold, the service invocation request is discarded.
Specifically, after the real-time service request threshold of the system is determined through the above steps, the received service invocation request may be processed correspondingly based on the overload protection mechanism and according to the service request threshold. For example, when the system receives a service invocation request, the relationship between the concurrent service request number of the system at the moment and the service request threshold is judged, and if the concurrent service request number of the system at the moment is smaller than the service request threshold, it indicates that the CPU of the system at the moment is not overloaded, that is, the system is capable of processing the service invocation request, so that the corresponding service invocation can be performed according to the service invocation request, that is, the corresponding service invocation processing is performed on the service invocation request. If the number of concurrent service requests of the system at the moment is greater than or equal to the service request threshold value, the CPU of the system at the moment is fully loaded, that is, the system has no capability to process the service call request, so that the service call request is discarded in order to ensure the normal operation of the system.
The method for processing the service overload obtains the service request threshold value of the system at the next moment by obtaining the resource data of the system and the current load information of the system at the current moment and according to the size relation between the resource data and the current load information, when the system receives the service calling request at the next moment, if the number of the concurrent service requests of the system is smaller than the service request threshold value, corresponding service calling is carried out according to the service calling request, and if the number of the concurrent service requests of the system is larger than or equal to the service request threshold value, the service calling request is discarded. Therefore, overload protection is carried out on the system based on the dynamically adjusted service request threshold, the problems of large workload and low accuracy of manual setting of the service request threshold are solved, and based on the dynamic service request threshold, the system can be guaranteed to be capable of tolerating timely burst flow spikes and can be guaranteed to provide services to the maximum extent under the condition that the system does not exceed the processing capacity of the system.
In an exemplary embodiment, the resource data of the system includes the number of CPU cores of the system, and the current load information of the system at the current time includes the number of tasks currently being executed by the system. In step S120, according to the size relationship between the resource data and the current load information, a service request threshold of the system at the next time is obtained, which specifically includes: if the number of tasks currently executed by the system is larger than the number of CPU cores of the system, reducing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; if the number of tasks currently executed by the system is less than the number of CPU cores of the system, increasing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; and if the number of the tasks currently executed by the system is equal to the number of the CPU cores of the system, taking the current service request threshold value of the system at the current moment as the service request threshold value of the system at the next moment.
The number of tasks currently being executed by the system refers to the number of threads currently in Running state by the system. In this embodiment, whether the system is overloaded may be determined based on the number of tasks currently being executed by the system and the number of CPU cores of the system. Specifically, if the number of tasks currently being executed by the system is greater than the number of CPU cores of the system, the system is overloaded, and at this time, the service request threshold of the system at the next time can be obtained by reducing the current service request threshold of the system at the current time, so as to discard enough service call requests, and ensure that the remaining service call requests do not exceed the processing capacity of the system, so that the system can normally process the service call requests. If the number of tasks currently executed by the system is less than the number of CPU cores of the system, it indicates that the system is not overloaded, that is, the system has the capability of processing more service invocation requests, so that the service invocation threshold of the system at the next time can be obtained by increasing the current service request threshold of the system at the current time, so that the system can tolerate a timely burst traffic spike, and process the service invocation request to the maximum extent. If the number of tasks currently executed by the system is equal to the number of CPU cores of the system, the system enters a relatively stable state, so that the current service request threshold value of the system at the current moment can be used as the service request threshold value of the system at the next moment. It should be noted that the current service request threshold of the system at the current time may be an initial service request threshold set for the system, or may be calculated in real time based on the initial service request threshold of the system and by combining the above method. Specifically, the initial service request threshold of the system may be any value greater than 0, or may be given an empirical value, such as 10 times the number of CPU cores. In the present embodiment, regardless of the initial service request threshold setting of the system, it can be converged to a suitable value quickly by the method shown in fig. 1.
In the embodiment, the current service request threshold of the system at the current moment is adjusted based on the size relationship between the number of tasks currently executed by the system and the number of CPU cores of the system, so as to obtain the service request threshold of the system at the next moment, so that the obtained service request threshold is more suitable for the condition of the system, and the problem of low accuracy of manually configuring the threshold is avoided.
In an exemplary embodiment, as shown in fig. 2, the resource data of the system includes the number of CPU cores of the system, and the current load information of the system at the current time includes the number of tasks currently being executed by the system. In step S120, according to the size relationship between the resource data and the current load information, a service request threshold of the system at the next time is calculated, which may specifically be implemented by the following steps:
in step S121, the current concurrent service request number and the current service request threshold of the system at the current time are obtained.
The current concurrent service request number refers to the number of service call requests being processed by the system at the current time. This can be achieved by simple counting, such as adding 1 every time the system receives a service invocation request, and subtracting 1 (whether successful or failed) every time it processes a service invocation request. Therefore, the current concurrent service request number of the system at the current moment can be obtained through the counting result of the system at the current moment. The current service request threshold may be an initial service request threshold set for the system, or may be a service request threshold of the system at the current time obtained by real-time calculation based on the initial service request threshold of the system and combining the method.
In step S122, a first estimated value of the service request threshold of the system at the next time is calculated according to the first set value, the resource data of the system, the current load information of the system at the current time, and the current service request threshold.
In this embodiment, a first estimation value of the service request threshold of the system at the next time is calculated based on the set gradient descent algorithm according to the first set value and the resource data of the system, the current load information of the system at the current time, and the current service request threshold. Wherein the first set value is used to characterize a learning rate in a gradient descent algorithm, which is used to calculate and define a magnitude of the first estimate value. Specifically, the offset of the service request threshold of the system at the next time is obtained by obtaining a difference between the resource data of the system and the current load information of the system at the current time, extracting a quotient between the difference and the current load information of the system at the current time, and further obtaining a product of the obtained quotient, a first set value and the current service request threshold of the system at the current time, and the sum of the offset of the current service request threshold of the system at the current time and the offset of the service request threshold of the system at the next time is obtained and determined as a first estimated value of the service request threshold of the system at the next time.
For example, taking resource data of the system as the number of CPU cores (represented by CPU) of the system, and current load information of the system at the current time (i.e. time t) as the number of tasks (represented by load (t)) being executed by the system at the current time, assuming that the current service request threshold of the system at the current time (i.e. time t) is ct (t), the first set value is α, which is a real number greater than or equal to 0 and less than 1, and is used for characterizing a learning rate in a gradient descent algorithm, which can control an iteration speed of the first estimate value, in this embodiment, the effect is the best when α is 0.1. Then based on the set gradient descent algorithm, the first estimate of the service request threshold for the system at the next time (i.e., time t +1) is calculated as:
Figure BDA0002750529630000101
in step S123, a second estimated value of the service request threshold of the system at the next time is calculated based on the second set value and the current number of concurrent service requests of the system at the current time.
Wherein the second set value is used for characterizing the expansion and contraction rate in the gradient descent algorithm, and is used for calculating and limiting the size of the second estimation value. Specifically, the second set value may be a constant greater than 1, and in the present embodiment, the maximum value of the second estimated value may be controlled by the second set value, thereby preventing the second estimated value from increasing infinitely. In this embodiment, assuming that the current number of concurrent service requests of the system at the current time (i.e., time t) is c (t), and the second set value is β, the second estimated value of the service request threshold obtained by the system at the next time (i.e., time t +1) is:
CT(t+1)2=β*C(t)。
the product of the current concurrent service request number C (t) of the system at the current moment and the second set value beta is used as a second estimated value of the service request threshold value of the system at the next moment.
In step S124, the minimum value of the first estimated value and the second estimated value of the service request threshold of the system at the next time is extracted, and the minimum value is used as the service request threshold of the system at the next time.
Specifically, the minimum value of the first estimation value and the second estimation value of the service request threshold value of the system at the next time is used as the service request threshold value of the system at the next time. Assuming that the service request threshold of the system at the next time is CT (t +1), then:
CT(t+1)=min(CT(t+1)1,CT(t+1)2). Substituting the above formula, then there are:
Figure BDA0002750529630000102
as can be seen from the above equation, when Load > CPU, CT (t +1) will tend to decrease, more easily resulting in service call requests being dropped, causing Load to drop. And the larger the Load, the faster the descent speed, and the closer the Load is to the CPU, the slower the descent speed. When Load is CPU, it is a stable state, i.e. CT (t +1) will not change any more (in reality it is unlikely to maintain this state), and it can only approach as much as possible and oscillate a little around the CPU. When Load < CPU, CT (t +1) will continue to increase, allowing more requests to be processed (including the bursty traffic spikes noted above), until Load increases beyond the CPU, the above-described decrease CT (t +1) is repeated. If there are fewer external service call requests and Load is always smaller than CPU, CT (t +1) will grow indefinitely, but it does not make sense. Therefore, a limitation is imposed by β × c (t), for example, if β is 2, CT is only 2 times as many as the actual concurrent requests at most, which basically satisfies most cases.
In the embodiment, the service request threshold value at the t +1 moment is estimated by adopting a gradient descent algorithm according to each parameter value at the t moment, so that the final load information tends to be close to or smaller than the resource data of the system, and the service request threshold value also tends to be a stable value.
It should be understood that although the various steps in the flow diagrams of fig. 1-2 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1-2 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
Fig. 3 is a block diagram illustrating a service overload processing apparatus according to an example embodiment. Referring to fig. 3, the apparatus includes a data acquisition module 302, a threshold estimation module 304, and a service processing module 306.
A data obtaining module 302 configured to perform obtaining resource data of a system providing a service in the distributed system architecture and current load information of the system at a current time;
a threshold estimation module 304 configured to perform calculating a service request threshold of the system at a next time according to a magnitude relation between the resource data and the current load information;
the service processing module 306 is configured to execute, when the system receives a service invocation request at the next moment, if the number of concurrent service requests of the system is less than the service request threshold, performing corresponding service invocation according to the service invocation request; and if the number of the concurrent service requests of the system is greater than or equal to the service request threshold value, discarding the service call request.
In an exemplary embodiment, the resource data of the system includes the number of CPU cores of the system, and the current load information of the system at the current time includes the number of tasks currently being executed by the system; the threshold estimation module 304 is configured to perform: if the number of tasks currently executed by the system is larger than the number of CPU cores of the system, reducing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; if the number of tasks currently executed by the system is less than the number of CPU cores of the system, increasing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment; and if the number of the tasks currently executed by the system is equal to the number of the CPU cores of the system, taking the current service request threshold value of the system at the current moment as the service request threshold value of the system at the next moment.
In an exemplary embodiment, the threshold estimation module 304 includes: the data acquisition unit is configured to acquire the current concurrent service request number and the current service request threshold value of the system at the current moment; a first estimated value obtaining unit configured to calculate a first estimated value of a service request threshold of the system at a next time according to a first set value and resource data of the system, current load information of the system at the current time and a current service request threshold, wherein the first set value is used for representing a learning rate in a gradient descent algorithm and is used for calculating and limiting the size of the first estimated value; a second estimated value obtaining unit, configured to calculate a second estimated value of a service request threshold of the system at a next moment according to a second set value and the current number of concurrent service requests of the system at the current moment, wherein the second set value is used for representing the expansion and contraction rate in the gradient descent algorithm, and is used for calculating and limiting the size of the second estimated value; and the service request threshold acquisition unit is configured to extract the minimum value of the first estimation value and the second estimation value of the service request threshold of the system at the next moment, and the minimum value is taken as the service request threshold of the system at the next moment.
In an exemplary embodiment, the first evaluation value acquisition unit is configured to perform: acquiring a difference value between resource data of a system and current load information of the system at the current moment; extracting a quotient between the difference value and the current load information of the system at the current moment; obtaining the product of the quotient, the first set value and the current service request threshold value of the system at the current moment to obtain the offset of the service request threshold value of the system at the next moment; the method comprises the steps of obtaining the sum of the current service request threshold value of the system at the current moment and the offset of the service request threshold value of the system at the next moment, and determining the sum as a first estimated value of the service request threshold value of the system at the next moment.
In an exemplary embodiment, the second estimated value acquiring unit is configured to perform: and obtaining the product of the current concurrent service request number of the system at the current moment and a second set value, and determining the product as a second estimated value of the service request threshold value of the system at the next moment.
In an exemplary embodiment, the first set value is in the interval of [0,1), and the second set value is greater than 1.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 4 is a block diagram illustrating a device Z00 for a method of handling a service overload according to an example embodiment. For example, device Z00 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, and the like.
Referring to fig. 4, device Z00 may include one or more of the following components: a processing component Z02, a memory Z04, a power component Z06, a multimedia component Z08, an audio component Z10, an interface to input/output (I/O) Z12, a sensor component Z14 and a communication component Z16.
The processing component Z02 generally controls the overall operation of the device Z00, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component Z02 may include one or more processors Z20 to execute instructions to perform all or part of the steps of the method described above. Further, the processing component Z02 may include one or more modules that facilitate interaction between the processing component Z02 and other components. For example, the processing component Z02 may include a multimedia module to facilitate interaction between the multimedia component Z08 and the processing component Z02.
The memory Z04 is configured to store various types of data to support operations at device Z00. Examples of such data include instructions for any application or method operating on device Z00, contact data, phonebook data, messages, pictures, videos, etc. The memory Z04 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component Z06 provides power to the various components of the device Z00. The power component Z06 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device Z00.
The multimedia component Z08 comprises a screen between the device Z00 and the user providing an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component Z08 includes a front facing camera and/or a rear facing camera. When device Z00 is in an operating mode, such as a capture mode or a video mode, the front-facing camera and/or the rear-facing camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component Z10 is configured to output and/or input an audio signal. For example, the audio component Z10 includes a Microphone (MIC) configured to receive external audio signals when the device Z00 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory Z04 or transmitted via the communication component Z16. In some embodiments, the audio component Z10 further includes a speaker for outputting audio signals.
The I/O interface Z12 provides an interface between the processing component Z02 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly Z14 includes one or more sensors for providing status assessment of various aspects to the device Z00. For example, sensor assembly Z14 may detect the open/closed state of device Z00, the relative positioning of the components, such as the display and keypad of device Z00, sensor assembly Z14 may also detect a change in the position of one component of device Z00 or device Z00, the presence or absence of user contact with device Z00, the orientation or acceleration/deceleration of device Z00, and a change in the temperature of device Z00. The sensor assembly Z14 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly Z14 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly Z14 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component Z16 is configured to facilitate wired or wireless communication between device Z00 and other devices. Device Z00 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component Z16 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component Z16 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the device Z00 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as the memory Z04, comprising instructions executable by the processor Z20 of the device Z00 to perform the above method. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for handling service overload, the method comprising:
acquiring resource data of a system providing services in a distributed system architecture and current load information of the system at the current moment, and calculating a service request threshold value of the system at the next moment according to the magnitude relation between the resource data and the current load information;
when the system receives a service calling request at the next moment, if the number of the concurrent service requests of the system is smaller than the service request threshold value, corresponding service calling is carried out according to the service calling request;
and if the number of the concurrent service requests of the system is greater than or equal to the service request threshold value, discarding the service call request.
2. The method of claim 1, wherein the resource data of the system comprises a number of CPU cores of the system, and the current load information of the system at the current time comprises a number of tasks currently being executed by the system; the calculating a service request threshold of the system at the next moment according to the size relationship between the resource data and the current load information includes:
if the number of tasks currently executed by the system is larger than the number of CPU cores of the system, reducing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment;
if the number of tasks currently executed by the system is smaller than the number of CPU cores of the system, increasing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment;
and if the number of the tasks currently executed by the system is equal to the number of the CPU cores of the system, taking the current service request threshold value of the system at the current moment as the service request threshold value of the system at the next moment.
3. The method of claim 1, wherein calculating the service request threshold of the system at the next time according to the magnitude relationship between the resource data and the current load information comprises:
acquiring the current concurrent service request number and the current service request threshold value of the system at the current moment;
calculating a first estimation value of a service request threshold value of the system at the next moment according to a first set value, resource data of the system, current load information of the system at the current moment and the current service request threshold value, wherein the first set value represents a learning rate in a gradient descent algorithm and is used for calculating and limiting the size of the first estimation value;
calculating a second estimation value of the service request threshold value of the system at the next moment according to a second set value and the current concurrent service request number of the system at the current moment, wherein the second set value represents the expansion and contraction rate in the gradient descent algorithm and is used for calculating and limiting the size of the second estimation value;
and extracting the minimum value of the first estimation value and the second estimation value of the service request threshold value of the system at the next moment, and taking the minimum value as the service request threshold value of the system at the next moment.
4. The method of claim 3, wherein calculating the first estimated value of the service request threshold of the system at the next time according to the first set value and the resource data of the system, the current load information of the system at the current time and the current service request threshold comprises:
acquiring a difference value between the resource data of the system and the current load information of the system at the current moment;
extracting a quotient between the difference value and the current load information of the system at the current moment;
obtaining the product of the quotient, the first set value and the current service request threshold value of the system at the current moment to obtain the offset of the service request threshold value of the system at the next moment;
and acquiring the sum of the current service request threshold value of the system at the current moment and the offset of the service request threshold value of the system at the next moment, and determining the sum as a first estimated value of the service request threshold value of the system at the next moment.
5. The method of claim 3, wherein calculating a second estimated value of the service request threshold of the system at the next time based on the second set value and the number of concurrent service requests of the system at the current time comprises:
and obtaining the product of the current concurrent service request number of the system at the current moment and the second set value, and determining the product as a second estimated value of the service request threshold value of the system at the next moment.
6. A method according to claim 3, characterized in that the first set value is in the interval [0,1) and the second set value is greater than 1.
7. An apparatus for handling service overload, the apparatus comprising:
the system comprises a data acquisition module, a data acquisition module and a data processing module, wherein the data acquisition module is configured to acquire resource data of a system providing services in a distributed system architecture and current load information of the system at the current moment;
a threshold estimation module configured to calculate a service request threshold of the system at a next moment according to a magnitude relation between the resource data and current load information;
the service processing module is configured to execute corresponding service calling according to the service calling request if the number of the concurrent service requests of the system is smaller than the service request threshold when the system receives the service calling request at the next moment; and if the number of the concurrent service requests of the system is greater than or equal to the service request threshold value, discarding the service call request.
8. The apparatus of claim 7, wherein the resource data of the system comprises a number of CPU cores of the system, and wherein the current load information of the system at the current time comprises a number of tasks currently being executed by the system; the threshold estimation module is configured to perform:
if the number of tasks currently executed by the system is larger than the number of CPU cores of the system, reducing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment;
if the number of tasks currently executed by the system is smaller than the number of CPU cores of the system, increasing the current service request threshold value of the system at the current moment to obtain the service request threshold value of the system at the next moment;
and if the number of the tasks currently executed by the system is equal to the number of the CPU cores of the system, taking the current service request threshold value of the system at the current moment as the service request threshold value of the system at the next moment.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of handling service overload of any one of claims 1 to 6.
10. A storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the method of processing a service overload of any one of claims 1 to 6.
CN202011182370.3A 2020-10-29 2020-10-29 Service overload processing method and device, electronic equipment and storage medium Pending CN112256432A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011182370.3A CN112256432A (en) 2020-10-29 2020-10-29 Service overload processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011182370.3A CN112256432A (en) 2020-10-29 2020-10-29 Service overload processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112256432A true CN112256432A (en) 2021-01-22

Family

ID=74267193

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011182370.3A Pending CN112256432A (en) 2020-10-29 2020-10-29 Service overload processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112256432A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338816A (en) * 2021-12-22 2022-04-12 阿里巴巴(中国)有限公司 Concurrency control method, device, equipment and storage medium under server-free architecture

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107608788A (en) * 2017-08-29 2018-01-19 北京三快在线科技有限公司 A kind of control method, device and equipment
CN108667882A (en) * 2017-04-01 2018-10-16 北京京东尚科信息技术有限公司 Load-balancing method, device and electronic equipment based on changeable weight adjustment
WO2019104974A1 (en) * 2017-11-30 2019-06-06 平安科技(深圳)有限公司 Dubbo platform-based automatic server starting and stopping method , server, and storage medium
CN110502345A (en) * 2019-08-26 2019-11-26 北京博睿宏远数据科技股份有限公司 A kind of overload protection method, device, computer equipment and storage medium
CN111694669A (en) * 2020-06-12 2020-09-22 深圳前海微众银行股份有限公司 Task processing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667882A (en) * 2017-04-01 2018-10-16 北京京东尚科信息技术有限公司 Load-balancing method, device and electronic equipment based on changeable weight adjustment
CN107608788A (en) * 2017-08-29 2018-01-19 北京三快在线科技有限公司 A kind of control method, device and equipment
WO2019104974A1 (en) * 2017-11-30 2019-06-06 平安科技(深圳)有限公司 Dubbo platform-based automatic server starting and stopping method , server, and storage medium
CN110502345A (en) * 2019-08-26 2019-11-26 北京博睿宏远数据科技股份有限公司 A kind of overload protection method, device, computer equipment and storage medium
CN111694669A (en) * 2020-06-12 2020-09-22 深圳前海微众银行股份有限公司 Task processing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338816A (en) * 2021-12-22 2022-04-12 阿里巴巴(中国)有限公司 Concurrency control method, device, equipment and storage medium under server-free architecture

Similar Documents

Publication Publication Date Title
CN109408207B (en) Microservice access control method, microservice access control device and storage medium
CN109474538B (en) Data transmission method and device, terminal equipment and storage medium
EP3343996A1 (en) Method and apparatus for triggering reporting buffer status report and user equipment
US9924090B2 (en) Method and device for acquiring iris image
CN106713734B (en) Automatic focusing method and device
CN107040591B (en) Method and device for controlling client
US20210333153A1 (en) Body temperature monitoring device, access control system, and access control method
KR20220133858A (en) Task scheduling method and apparatus, electronic device, storage medium and program product
CN109698794B (en) Congestion control method and device, electronic equipment and storage medium
CN108427630B (en) Performance information acquisition method, device, terminal and computer readable storage medium
CN107480785B (en) Convolutional neural network training method and device
EP3813223A1 (en) Charging control method, device and storage medium
RU2648264C2 (en) Method and device (variants) for processing communication messages
CN112256432A (en) Service overload processing method and device, electronic equipment and storage medium
CN110908814A (en) Message processing method and device, electronic equipment and storage medium
CN106790450B (en) Method for caching and processing, device and server
CN114518959A (en) Distributed node resource load balancing method and device and electronic equipment
CN116089025A (en) Processor frequency control method, device and storage medium
CN111698414B (en) Image signal processing method and device, electronic device and readable storage medium
CN113487711A (en) Blink control method and device for virtual image, electronic equipment and storage medium
CN108984294B (en) Resource scheduling method, device and storage medium
CN112449409B (en) Power control method of mobile terminal and power control device of mobile terminal
CN110716985B (en) Node information processing method, device and medium
CN110637443B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN108401509B (en) Measurement configuration method and device

Legal Events

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