CN107678861B - Method and device for processing function execution request - Google Patents

Method and device for processing function execution request Download PDF

Info

Publication number
CN107678861B
CN107678861B CN201710959786.3A CN201710959786A CN107678861B CN 107678861 B CN107678861 B CN 107678861B CN 201710959786 A CN201710959786 A CN 201710959786A CN 107678861 B CN107678861 B CN 107678861B
Authority
CN
China
Prior art keywords
target function
function interface
health
current
state
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
CN201710959786.3A
Other languages
Chinese (zh)
Other versions
CN107678861A (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.)
Guangzhou Kugou Computer Technology Co Ltd
Original Assignee
Guangzhou Kugou Computer 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 Guangzhou Kugou Computer Technology Co Ltd filed Critical Guangzhou Kugou Computer Technology Co Ltd
Priority to CN201710959786.3A priority Critical patent/CN107678861B/en
Publication of CN107678861A publication Critical patent/CN107678861A/en
Application granted granted Critical
Publication of CN107678861B publication Critical patent/CN107678861B/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/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
    • 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/508Monitor

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The disclosure relates to a method and a device for processing function execution requests, and belongs to the technical field of electronics. The method comprises the following steps: acquiring the current occupancy rate of a processor, the current state parameters of a target function interface and the pre-stored historical state parameters of the target function interface; determining a current health status grade of the target function interface based on the occupancy rate, the current status parameter and the historical status parameter; determining a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode comprises execution and execution refusal; and processing the function execution request corresponding to the target function interface based on the request processing mode. By adopting the method and the device, the problem that the application cannot be normally used when the functional interface is abnormal can be solved.

Description

Method and device for processing function execution request
Technical Field
The present disclosure relates to the field of electronic technologies, and in particular, to a method and an apparatus for processing a function execution request.
Background
With the development of electronic technology, the amount of access that a server in a network can support is larger and larger, and multiple people can be supported to access simultaneously.
For a certain application, a server of the application may have a plurality of functional interfaces, such as a login interface, an upload interface, a comment interface, an order submission interface, and the like. The server receives function execution requests corresponding to different function interfaces sent by the terminal in the running process and carries out corresponding processing.
In carrying out the present disclosure, the inventors found that at least the following problems exist:
all functional interfaces of an application use the same thread pool to perform processing, and the number of threads in the thread pool is limited. If the function execution requests of a certain functional interface suddenly increase, more threads are occupied to execute the function execution requests, and the other functional interfaces may not be able to normally execute the corresponding processing. For example, for a shopping application, during a promotional campaign, many users submit orders simultaneously, and the order submission requests of the order submission interface increase suddenly, possibly resulting in other users not being able to log into the shopping application. Thus, the application cannot be normally used.
Disclosure of Invention
The present disclosure provides a method and an apparatus for processing a function execution request, which can solve the problem that an application cannot be normally used when a functional interface is abnormal. The technical scheme is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a method of processing a function execution request, the method comprising:
acquiring the current occupancy rate of a processor, the current state parameters of a target function interface and the pre-stored historical state parameters of the target function interface;
determining a current health status grade of the target function interface based on the occupancy rate, the current status parameter and the historical status parameter;
determining a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode comprises execution and execution refusal;
and processing the function execution request corresponding to the target function interface based on the request processing mode.
Optionally, the determining the current health status level of the target function interface based on the occupancy rate, the current status parameter, and the historical status parameter includes:
and inputting the occupancy rate, the current state parameter and the historical state parameter into a pre-trained health state grade classification model to obtain the current health state grade of the target function interface.
Optionally, the method further includes:
acquiring occupancy rates of processors at a plurality of different moments, state parameters of the target function interface at the plurality of different moments, and historical state parameters of the target function interface stored at the plurality of different moments;
determining state change parameters of the target function interface at the different moments based on the state parameters of the target function interface at the different moments and historical state parameters of the target function interface stored at the different moments;
acquiring a first weight corresponding to the pre-stored occupancy rate and a second weight corresponding to the state change parameter, respectively determining the occupancy rate of the processor and a weighted value of the state change parameter corresponding to a plurality of different moments according to the first weight and the second weight, as health state values of the target function interface at the plurality of different moments, and determining the health state grades of the target function interface at the plurality of different moments according to the health state values of the target function interface at the plurality of different moments;
and taking the occupancy rates of the processors at the different moments, the state parameters of the target function interface at the different moments, the historical state parameters of the target function interface stored at the different moments and the health state grades at the different moments as training samples to train the health state grade classification model.
Optionally, the health status levels include at least a high health level or a low health level;
the determining of the request processing mode corresponding to the current health state level of the target function interface includes:
if the current health state grade of the target function interface is a high health grade, determining the request processing mode of the function execution request corresponding to the target function interface as execution;
and if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute.
Optionally, the health status levels include at least a high health level, a medium health level, or a low health level;
the determining of the request processing mode corresponding to the current health state level of the target function interface includes:
if the current health state grade of the target function interface is a high health grade or a medium health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is execution;
if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute;
if the current health status level of the target function interface is a middle health status, the method further comprises:
and sending a health state alarm notice of the target function interface to a management terminal.
Optionally, the current state parameter of the target function interface includes one or more of the following: the average response time of the current thread of the target function interface, the maximum response time of the current thread of the target function interface, the minimum response time of the current thread of the target function interface and the number of the currently occupied threads of the target function interface;
when the current state parameter of the target function interface comprises the current thread average response time of the target function interface, the historical state parameter of the target function interface comprises: historical thread average response time of the target function interface;
when the current state parameter of the target function interface includes the maximum response time of the current thread of the target function interface, the historical state parameter of the target function interface includes: the maximum response time of the historical thread of the target function interface;
when the current state parameter of the target function interface comprises the current thread minimum response time of the target function interface, the historical state parameter of the target function interface comprises: the historical thread minimum response time of the target function interface;
when the current state parameter of the target function interface includes the current thread number occupied by the target function interface, the historical state parameter of the target function interface includes: and the historical average occupied thread number of the target function interface.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for processing a function execution request, the apparatus comprising:
the first acquisition module is used for acquiring the current occupancy rate of the processor, the current state parameters of the target function interface and the pre-stored historical state parameters of the target function interface;
a first determining module, configured to determine a current health status level of the target function interface based on the occupancy rate, the current status parameter, and the historical status parameter;
a second determining module, configured to determine a request processing manner corresponding to the current health status level of the target function interface, where the request processing manner includes execution and execution rejection;
and the processing module is used for processing the function execution request corresponding to the target function interface based on the request processing mode.
Optionally, the first determining module is configured to:
and inputting the occupancy rate, the current state parameter and the historical state parameter into a pre-trained health state grade classification model to obtain the current health state grade of the target function interface.
Optionally, the apparatus further comprises:
a second obtaining module, configured to obtain occupancy rates of processors at multiple different times, state parameters of the target function interface at the multiple different times, and historical state parameters of the target function interface stored at the multiple different times;
a third determining module, configured to determine state change parameters of the target function interface at the multiple different times based on the state parameters of the target function interface at the multiple different times and historical state parameters of the target function interface stored at the multiple different times;
a fourth determining module, configured to obtain a first weight corresponding to the occupancy rate and a second weight corresponding to the state change parameter, which are stored in advance, and determine, according to the first weight and the second weight, a weighted value of the occupancy rate and the state change parameter of the processor corresponding to a plurality of different times, as a health state value of the target function interface at the plurality of different times, and determine, according to the health state value of the target function interface at the plurality of different times, a health state rank of the target function interface at the plurality of different times;
and the training module is used for taking the occupancy rates of the processors at the different moments, the state parameters of the target function interface at the different moments, the historical state parameters of the target function interface stored at the different moments and the health state grades at the different moments as training samples to train the health state grade classification model.
Optionally, the health status levels include at least a high health level or a low health level;
the second determination module is to:
if the current health state grade of the target function interface is a high health grade, determining the request processing mode of the function execution request corresponding to the target function interface as execution;
and if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute.
Optionally, the health status levels include at least a high health level, a medium health level, or a low health level;
the second determination module is to:
if the current health state grade of the target function interface is a high health grade or a medium health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is execution;
if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute;
if the current health status level of the target function interface is a middle health status, the method further comprises:
and sending a health state alarm notice of the target function interface to a management terminal.
Optionally, the current state parameter of the target function interface includes one or more of the following: the average response time of the current thread of the target function interface, the maximum response time of the current thread of the target function interface, the minimum response time of the current thread of the target function interface and the number of the currently occupied threads of the target function interface;
when the current state parameter of the target function interface comprises the current thread average response time of the target function interface, the historical state parameter of the target function interface comprises: historical thread average response time of the target function interface;
when the current state parameter of the target function interface includes the maximum response time of the current thread of the target function interface, the historical state parameter of the target function interface includes: the maximum response time of the historical thread of the target function interface;
when the current state parameter of the target function interface comprises the current thread minimum response time of the target function interface, the historical state parameter of the target function interface comprises: the historical thread minimum response time of the target function interface;
when the current state parameter of the target function interface includes the current thread number occupied by the target function interface, the historical state parameter of the target function interface includes: and the historical average occupied thread number of the target function interface.
According to a third aspect of the embodiments of the present disclosure, there is provided a server, the server including a processor and a memory, the memory having at least one instruction stored therein, the instruction being loaded and executed by the processor to implement the method for processing a function execution request according to the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the method for processing a function execution request according to the first aspect.
In the embodiment of the disclosure, a server acquires a current occupancy rate of a processor, a current state parameter of a target function interface, and a pre-stored historical state parameter of the target function interface, determines a current health state grade of the target function interface based on the occupancy rate, the current state parameter, and the historical state parameter, and determines a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode includes execution and rejection execution, and a function execution request corresponding to the target function interface is processed based on the request processing mode. Therefore, when the target function interface is abnormal, the function execution request for executing the target function interface can be refused so as to ensure the normal operation of other function interfaces and ensure the normal use of the application.
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. In the drawings:
FIG. 1 is a flow diagram illustrating a method of processing a function execution request in accordance with an exemplary embodiment;
FIG. 2 is a schematic diagram illustrating a server receiving function execution requests of a plurality of clients in accordance with an illustrative embodiment;
FIG. 3 is a diagram illustrating a health status level versus request handling according to an illustrative embodiment;
FIG. 4 is a diagram illustrating a health status level versus request handling according to an illustrative embodiment;
FIG. 5 is a schematic diagram illustrating an apparatus for processing a function execution request in accordance with an illustrative embodiment;
FIG. 6 is a schematic diagram illustrating an apparatus for processing a function execution request in accordance with an illustrative embodiment;
fig. 7 is a schematic diagram illustrating a configuration of a server according to an example embodiment.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. 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.
An exemplary embodiment of the present disclosure provides a method of processing a function execution request, which may be applied to a server.
The server may include a processor, memory, transceiver, etc. The processor, which may be a Central Processing Unit (CPU) or the like, may be configured to obtain data required in a Processing procedure, determine a health level of the functional interface, process a function execution request, and the like. The Memory may be a RAM (Random Access Memory), a Flash Memory, and the like, and may be configured to store received data, data required by the processing procedure, data generated in the processing procedure, and the like, such as an occupancy rate of the processor, a status parameter of the functional interface, and a historical status parameter of the functional interface. The transceiver may be configured to perform data transmission with the client or the management terminal, for example, receive a function execution request sent by the client, send a health status alarm notification to the management terminal, and the like.
As shown in fig. 1, the processing flow of the method may include the following steps:
in step 101, the current occupancy rate of the processor, the current status parameters of the target function interface, and the pre-stored historical status parameters of the target function interface are obtained.
The current state parameters of the target function interface may include one or more of the following: the average response time of the current thread of the target function interface, the maximum response time of the current thread of the target function interface, the minimum response time of the current thread of the target function interface and the number of the currently occupied threads of the target function interface.
Correspondingly, when the current state parameter of the target function interface includes the current thread average response time of the target function interface, the historical state parameter of the target function interface may include: the average response time of historical threads of the target function interface; when the current state parameter of the target function interface includes the current thread maximum response time of the target function interface, the historical state parameter of the target function interface may include: the maximum response time of the historical thread of the target function interface; when the current state parameter of the target function interface includes the current thread minimum response time of the target function interface, the historical state parameter of the target function interface may include: the minimum response time of the historical thread of the target function interface; when the current state parameter of the target function interface includes the current thread number occupied by the target function interface, the historical state parameter of the target function interface may include: the historical average number of threads occupied by the target functional interface.
In implementation, for an application, the corresponding server in the background supports the operation of each function. Each function has a corresponding function interface on the server, and function execution requests of the same function can be classified into one function interface. When the server receives a function execution request sent by the client, the server can determine a function interface corresponding to the function execution request and determine an unoccupied thread in the thread pool. Further, an unoccupied thread may be assigned to the function execution request, so that the processor may process the function execution request, and may feed back a processing result to the client after the processing is completed. The response time may be time taken from the time when a certain function execution request is received by the server to the time when the processing result of the function execution request is fed back to the client. As shown in fig. 2, the server may receive a function execution request sent by each client using the application, where there may be more than one function execution request for each function, and therefore, the server may allocate at least one thread to each function interface, and may detect the number of threads occupied by each function interface, count the response time of each function execution request, and store the count.
When the preset period is reached, the server can detect the occupancy rate of the processor at the current moment and acquire the current state parameters of each functional interface. Optionally, the obtaining of the current state parameter of each functional interface may be detecting the number of threads occupied by each functional interface at the current time, counting the stored response time of each functional interface in the latest period, obtaining the maximum response time of the thread and the minimum response time of the thread corresponding to each functional interface, and calculating an average value of all the response times in each functional interface period to obtain the average response time of the thread corresponding to each functional interface. The server may then read out the historical state parameters of each functional interface stored prior to the current time. Optionally, the historical state parameters of each functional interface at least include one or more of the following: the average response time of the historical threads of each functional interface, the maximum response time of the historical threads of each functional interface, the minimum response time of the historical threads of each functional interface and the average number of threads occupied by the historical threads of each functional interface. For the historical thread average response time of each functional interface, calculating an average value of the response time of each functional interface stored before the current period to obtain the historical thread average response time of each functional interface; for the maximum response time of the historical thread and the minimum response time of the historical thread of each functional interface, the response time of each functional interface stored before the current period can be counted to obtain the maximum response time of the historical thread and the minimum response time of the historical thread of each functional interface; for the historical average occupied thread number of each functional interface, an average value may be calculated for the thread number occupied by each functional interface stored before the current period, so as to obtain the historical average occupied thread number of each functional interface.
After obtaining the current state parameters of each functional interface, the server may store the current state parameters, and recalculate the historical state parameters of each functional interface according to the current state parameters, so as to facilitate the next cycle of use.
In step 102, a current health status level of the target function interface is determined based on the occupancy rate, the current status parameter, and the historical status parameter.
The health status level can be classified in the following two ways: first, the health status levels may include a high health level, a low health level; in a second way, the health status levels may include a high health level, a medium health level, and a low health level. The health status level may be classified in other ways, and is not limited herein.
In implementation, after acquiring the current occupancy rate of the processor, the current state parameter of each functional interface, and the pre-stored historical state parameter of each functional interface, the server may determine the current health state level of each functional interface according to the occupancy rate, the current state parameter, and the historical state parameter. Furthermore, the health status level of each functional interface in each preset period can be monitored. For example, corresponding weights may be set for the occupancy rate, the current state parameter, and the historical state parameter, and based on a conventional linear algorithm, the weighted values of the occupancy rate, the current state parameter, and the historical state parameter are calculated, so as to determine the current health state level of each functional interface; alternatively, the health status level of each functional interface may be classified based on an algorithm of machine learning using the occupancy rate, current status parameters, and historical status parameters of each functional interface.
Optionally, the machine training model may be used to classify the health status level of the functional interface, and the corresponding processing may be as follows: and inputting the occupancy rate, the current state parameter and the historical state parameter into a health state grade classification model trained in advance to obtain the current health state grade of the target function interface.
The health state grade classification model is a model established based on a machine learning algorithm, and can be a model established based on a decision tree algorithm, before the health state grade classification is performed on a functional interface with unknown health state grade, the model needs to be trained, and the corresponding processing can be as follows: acquiring occupancy rates of processors at a plurality of different moments, state parameters of target function interfaces at a plurality of different moments and historical state parameters of the target function interfaces stored at a plurality of different moments; determining state change parameters of the target function interfaces at different moments based on the state parameters of the target function interfaces at different moments and historical state parameters of the target function interfaces stored at different moments; acquiring a first weight corresponding to a pre-stored occupancy rate and a second weight corresponding to a state change parameter, respectively determining the occupancy rate of a processor and the weighted value of the state change parameter corresponding to a plurality of different moments according to the first weight and the second weight, taking the occupancy rate and the weighted value as health state values of the target function interface at the plurality of different moments, and determining the health state grades of the target function interface at the plurality of different moments according to the health state values of the target function interface at the plurality of different moments; and taking the occupancy rates of the processors at different moments, the state parameters of the target function interfaces at different moments, the historical state parameters of the target function interfaces stored at different moments and the health state grades at different moments as training samples to train the health state grade classification model.
In an implementation, the occupancy rates of the processors, the state parameters of each functional interface, and the historical state parameters of each functional interface at multiple times may be stored in the server, and the above parameters may be read out for processing. For each moment, the server may obtain a ratio of the state parameter of each functional interface to the historical state parameter, to obtain a state change parameter of each functional interface. For example, the average response time of the thread of each functional interface at a certain time may be compared with the average response time of the historical thread of each functional interface corresponding to the certain time, so as to obtain the change parameter of the average response time of the thread of each functional interface; the number of threads occupied by each functional interface at a certain moment can be compared with the historical average number of threads occupied by each functional interface corresponding to the moment, and the change parameter of the number of threads occupied by each functional interface can be respectively obtained.
Technicians can preset and store the occupancy rate and the weight of the state change parameters, and optionally, different weights can be set for the state change parameters corresponding to different state parameters. For each functional interface at multiple moments, the server may read a first weight corresponding to the occupancy rate and a second weight corresponding to the state change parameter, and respectively multiply the first weight by the value of the occupancy rate and multiply the second weight by the parameter value of the state change parameter, and add the obtained results to obtain the weighted value of the occupancy rate and the state change parameter as the health state value of the functional interface.
The health state value may be within a preset numerical range, and the numerical range may be divided into sub-ranges corresponding to the health state levels. For example, the health status value may be a value between [0,100], and for the first mode in the health status level classification, the [0,100] may be divided into two sub-ranges [0,40 ] and [40,100], where the health status level corresponding to the sub-range [0,40) is a high health level and the health status level corresponding to the sub-range [40,100] is a low health level; for the second mode, the sub-range [0,100] can be divided into three sub-ranges [0,30 ], [30,60 ] and [60,100], wherein the health status level corresponding to the sub-range [0,30) is a high health level, the health status level corresponding to the sub-range [30,60) is a medium health level, and the health status level corresponding to the sub-range [60,100] is a low health level. When the occupancy rate of the processor is higher, the processor is more busy, which may be caused by processing the function execution request corresponding to the function interface; when the state change parameter is higher, the state parameter of the functional interface at the moment is greater than the corresponding historical state parameter, for example, if the average response time of the thread is greater than the average response time of the historical thread, and the number of occupied threads is greater than the number of the historical occupied threads, the functional interface may be abnormal, and may affect the processing of the function execution requests of other functional interfaces. Therefore, the higher the health state value is, the worse the health state of the functional interface is, the lower the corresponding health state grade is; the lower the health status value, the better the health status of the functional interface, the higher the corresponding health status level.
Further, the sub-range to which the health status value belongs may be determined, the health status level corresponding to the sub-range may be determined, and the determined health status level may be used as the health status level of the corresponding functional interface.
After the health state grade corresponding to each functional interface at multiple moments is determined, the occupancy rates of the processors, the state parameters of each functional interface, the historical state parameters of each functional interface and the health state grade of each functional interface corresponding to multiple different moments can be used as training samples to train the health state grade classification model.
Furthermore, the server may input the current occupancy rate of the processor, the current state parameter of each functional interface, and the pre-stored historical state parameter of each functional interface into the trained health state grade classification model, output the current health state grade of each functional interface, and perform health state grade classification on the functional interface of each unknown health state grade.
In step 103, a request processing mode corresponding to the current health status level of the target function interface is determined.
The request processing mode comprises execution and refusal execution.
Optionally, as for the first mode, if the current health status level of the target function interface is a high health level, it may be determined that the request processing mode of the function execution request corresponding to the target function interface is execution; if the current health state level of the target function interface is a low health level, the request processing mode of the function execution request corresponding to the target function interface can be determined to be execution refusal. For the first mode, the correspondence between the health status level and the request processing mode is shown in fig. 3.
For the second mode, if the current health status level of the target function interface is a high health level or a medium health level, the request processing mode of the function execution request corresponding to the target function interface can be determined as execution; if the current health state level of the target function interface is a low health level, the request processing mode of the function execution request corresponding to the target function interface can be determined to be execution refusal. And if the current health state grade of the target function interface is the middle health state, determining to send a health state alarm notice of the target function interface to the management terminal. For the second mode, the correspondence between the health status level and the request processing mode is shown in fig. 4.
In step 104, the function execution request corresponding to the target function interface is processed based on the request processing method.
In implementation, for the function interface that determines the lower request processing mode to be execution, the corresponding function execution request may be continuously processed, and the processing result may be fed back to the client. For the functional interface that determines that the next request processing mode is execution refusal, the corresponding function execution request may not be executed temporarily, and at most a preset number of threads may be allocated to the functional interface after a preset time length, and further, the request processing mode of the functional interface may be re-determined, and the processing for re-determining the request processing mode is the same as or similar to the above processing, and details are not described here again. If the redetermined request processing mode is still refused to be executed, the corresponding function execution request is not executed temporarily, and the redetermination is carried out after the preset time length; if the determined request processing mode is execution, the corresponding function execution request is continuously processed, and the processing result can be fed back to the client.
Optionally, if the current health status level of the target function interface is the middle health status, a health status alarm notification of the target function interface may be sent to the management terminal, so as to send an alarm to a technician using the management terminal. The health status alert notification may carry an identification of the functional interface with a health status level of the medium health status level. When receiving the health state alarm notification, the management terminal may determine, according to the health state alarm notification, the functional interface whose health state level is the middle health state level, and may remind the technician that the functional interface is in the middle health state, where the reminding manner may be displayed on a screen, which is not limited herein. Furthermore, a technician can check the current state of the functional interface, find out the reason for the functional interface to be in the middle health state, and perform corresponding processing to avoid that the health state grade of the functional interface is reduced to the low health state grade to influence other functional interfaces.
In the embodiment of the disclosure, a server acquires a current occupancy rate of a processor, a current state parameter of a target function interface, and a pre-stored historical state parameter of the target function interface, determines a current health state grade of the target function interface based on the occupancy rate, the current state parameter, and the historical state parameter, and determines a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode includes execution and rejection execution, and a function execution request corresponding to the target function interface is processed based on the request processing mode. Therefore, when the target function interface is abnormal, the function execution request for executing the target function interface can be refused so as to ensure the normal operation of other function interfaces and ensure the normal use of the application.
Yet another exemplary embodiment of the present disclosure provides an apparatus for processing a function execution request, as shown in fig. 5, the apparatus including:
a first obtaining module 510, configured to obtain a current occupancy rate of a processor, a current state parameter of a target function interface, and a pre-stored historical state parameter of the target function interface;
a first determining module 520, configured to determine a current health status level of the target function interface based on the occupancy rate, the current status parameter, and the historical status parameter;
a second determining module 530, configured to determine a request processing manner corresponding to the current health status level of the target function interface, where the request processing manner includes execution and execution rejection;
the processing module 540 is configured to process the function execution request corresponding to the target function interface based on the request processing manner.
Optionally, the first determining module 520 is configured to:
and inputting the occupancy rate, the current state parameter and the historical state parameter into a pre-trained health state grade classification model to obtain the current health state grade of the target function interface.
Optionally, as shown in fig. 6, the apparatus further includes:
a second obtaining module 550, configured to obtain occupancy rates of processors at multiple different times, the status parameters of the target function interface at the multiple different times, and historical status parameters of the target function interface stored at the multiple different times;
a third determining module 560, configured to determine state change parameters of the target functional interface at the multiple different times based on the state parameters of the target functional interface at the multiple different times and historical state parameters of the target functional interface stored at the multiple different times;
a fourth determining module 570, configured to obtain a first weight corresponding to the occupancy rate and a second weight corresponding to the state change parameter, which are stored in advance, and determine, according to the first weight and the second weight, a weighted value of the occupancy rate and the state change parameter of the processor corresponding to multiple different times, as a health state value of the target function interface at the multiple different times, and determine, according to the health state value of the target function interface at the multiple different times, a health state rank of the target function interface at the multiple different times;
a training module 580, configured to train the health status class classification model by using the occupancy rates of the processors at the multiple different times, the status parameters of the target function interface at the multiple different times, the historical status parameters of the target function interface stored at the multiple different times, and the health status classes at the multiple different times as training samples.
Optionally, the health status levels include at least a high health level or a low health level;
the second determining module 530 is configured to:
if the current health state grade of the target function interface is a high health grade, determining the request processing mode of the function execution request corresponding to the target function interface as execution;
and if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute.
Optionally, the health status levels include at least a high health level, a medium health level, or a low health level;
the second determining module 530 is configured to:
if the current health state grade of the target function interface is a high health grade or a medium health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is execution;
if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute;
if the current health status level of the target function interface is a middle health status, the method further comprises:
and sending a health state alarm notice of the target function interface to a management terminal.
Optionally, the current state parameter of the target function interface includes one or more of the following: the average response time of the current thread of the target function interface, the maximum response time of the current thread of the target function interface, the minimum response time of the current thread of the target function interface and the number of the currently occupied threads of the target function interface;
when the current state parameter of the target function interface comprises the current thread average response time of the target function interface, the historical state parameter of the target function interface comprises: historical thread average response time of the target function interface;
when the current state parameter of the target function interface includes the maximum response time of the current thread of the target function interface, the historical state parameter of the target function interface includes: the maximum response time of the historical thread of the target function interface;
when the current state parameter of the target function interface comprises the current thread minimum response time of the target function interface, the historical state parameter of the target function interface comprises: the historical thread minimum response time of the target function interface;
when the current state parameter of the target function interface includes the current thread number occupied by the target function interface, the historical state parameter of the target function interface includes: and the historical average occupied thread number of the target function interface.
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.
In the embodiment of the disclosure, a server acquires a current occupancy rate of a processor, a current state parameter of a target function interface, and a pre-stored historical state parameter of the target function interface, determines a current health state grade of the target function interface based on the occupancy rate, the current state parameter, and the historical state parameter, and determines a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode includes execution and rejection execution, and a function execution request corresponding to the target function interface is processed based on the request processing mode. Therefore, when the target function interface is abnormal, the function execution request for executing the target function interface can be refused so as to ensure the normal operation of other function interfaces and ensure the normal use of the application.
It should be noted that: in the device for processing a function execution request according to the foregoing embodiment, when processing a function execution request, only the division of each function module is illustrated, and in practical applications, the function distribution may be completed by different function modules according to needs, that is, the internal structure of the server is divided into different function modules, so as to complete all or part of the functions described above. In addition, the apparatus for processing a function execution request and the method for processing a function execution request provided in the foregoing embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Yet another exemplary embodiment of the present disclosure provides a server. Referring to fig. 7, server 700 includes a processing component 722 that further includes one or more processors and memory resources, represented by memory 732, for storing instructions, such as applications, that are executable by processing component 722. The application programs stored in memory 732 may include one or more modules that each correspond to a set of instructions. Further, the processing component 722 is configured to execute instructions to perform the above-described method of processing a functional execution request.
The server 700 may also include a power component 726 configured to perform power management of the server 700, a wired or wireless network interface 750 configured to connect the server 700 to a network, and an input output (I/O) interface 758. The server 700 may operate based on an operating system stored in memory 732, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Server 700 may include a computer readable storage medium, and one or more programs, where the one or more programs are stored in the computer readable storage medium and configured to be executed by one or more processors the one or more programs include instructions for:
acquiring the current occupancy rate of a processor, the current state parameters of a target function interface and the pre-stored historical state parameters of the target function interface;
determining a current health status grade of the target function interface based on the occupancy rate, the current status parameter and the historical status parameter;
determining a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode comprises execution and execution refusal;
and processing the function execution request corresponding to the target function interface based on the request processing mode.
Optionally, the determining the current health status level of the target function interface based on the occupancy rate, the current status parameter, and the historical status parameter includes:
and inputting the occupancy rate, the current state parameter and the historical state parameter into a pre-trained health state grade classification model to obtain the current health state grade of the target function interface.
Optionally, the method further includes:
acquiring occupancy rates of processors at a plurality of different moments, state parameters of the target function interface at the plurality of different moments, and historical state parameters of the target function interface stored at the plurality of different moments;
determining state change parameters of the target function interface at the different moments based on the state parameters of the target function interface at the different moments and historical state parameters of the target function interface stored at the different moments;
acquiring a first weight corresponding to the pre-stored occupancy rate and a second weight corresponding to the state change parameter, respectively determining the occupancy rate of the processor and a weighted value of the state change parameter corresponding to a plurality of different moments according to the first weight and the second weight, as health state values of the target function interface at the plurality of different moments, and determining the health state grades of the target function interface at the plurality of different moments according to the health state values of the target function interface at the plurality of different moments;
and taking the occupancy rates of the processors at the different moments, the state parameters of the target function interface at the different moments, the historical state parameters of the target function interface stored at the different moments and the health state grades at the different moments as training samples to train the health state grade classification model.
Optionally, the health status levels include at least a high health level or a low health level;
the determining of the request processing mode corresponding to the current health state level of the target function interface includes:
if the current health state grade of the target function interface is a high health grade, determining the request processing mode of the function execution request corresponding to the target function interface as execution;
and if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute.
Optionally, the health status levels include at least a high health level, a medium health level, or a low health level;
the determining of the request processing mode corresponding to the current health state level of the target function interface includes:
if the current health state grade of the target function interface is a high health grade or a medium health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is execution;
if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute;
if the current health status level of the target function interface is a middle health status, the method further comprises:
and sending a health state alarm notice of the target function interface to a management terminal.
Optionally, the current state parameter of the target function interface includes one or more of the following: the average response time of the current thread of the target function interface, the maximum response time of the current thread of the target function interface, the minimum response time of the current thread of the target function interface and the number of the currently occupied threads of the target function interface;
when the current state parameter of the target function interface comprises the current thread average response time of the target function interface, the historical state parameter of the target function interface comprises: historical thread average response time of the target function interface;
when the current state parameter of the target function interface includes the maximum response time of the current thread of the target function interface, the historical state parameter of the target function interface includes: the maximum response time of the historical thread of the target function interface;
when the current state parameter of the target function interface comprises the current thread minimum response time of the target function interface, the historical state parameter of the target function interface comprises: the historical thread minimum response time of the target function interface;
when the current state parameter of the target function interface includes the current thread number occupied by the target function interface, the historical state parameter of the target function interface includes: and the historical average occupied thread number of the target function interface.
In the embodiment of the disclosure, a server acquires a current occupancy rate of a processor, a current state parameter of a target function interface, and a pre-stored historical state parameter of the target function interface, determines a current health state grade of the target function interface based on the occupancy rate, the current state parameter, and the historical state parameter, and determines a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode includes execution and rejection execution, and a function execution request corresponding to the target function interface is processed based on the request processing mode. Therefore, when the target function interface is abnormal, the function execution request for executing the target function interface can be refused so as to ensure the normal operation of other function interfaces and ensure the normal use of the application.
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 application 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 of processing a function execution request, the method comprising:
acquiring the current occupancy rate of a processor, the current state parameters of a target function interface and the pre-stored historical state parameters of the target function interface, wherein the current state parameters of the target function interface comprise one or more of the following parameters: the average response time of the current thread of the target function interface, the maximum response time of the current thread of the target function interface, the minimum response time of the current thread of the target function interface and the number of the currently occupied threads of the target function interface;
inputting the occupancy rate, the current state parameter and the historical state parameter into a pre-trained health state grade classification model to obtain the current health state grade of the target function interface, wherein the health state grade classification model is a model established based on a decision tree algorithm;
determining a request processing mode corresponding to the current health state grade of the target function interface, wherein the request processing mode comprises execution and execution refusal;
processing a function execution request corresponding to the target function interface based on the request processing mode;
the training process of the pre-trained health state grade classification model comprises the following steps:
acquiring occupancy rates of processors at a plurality of different moments, state parameters of the target function interface at the plurality of different moments, and historical state parameters of the target function interface stored at the plurality of different moments;
determining state change parameters of the target function interface at the different moments based on the state parameters of the target function interface at the different moments and historical state parameters of the target function interface stored at the different moments;
acquiring a first weight corresponding to the pre-stored occupancy rate and a second weight corresponding to the state change parameter, respectively determining the occupancy rate of the processor and a weighted value of the state change parameter corresponding to a plurality of different moments according to the first weight and the second weight, as health state values of the target function interface at the plurality of different moments, and determining the health state grades of the target function interface at the plurality of different moments according to the health state values of the target function interface at the plurality of different moments;
and taking the occupancy rates of the processors at the different moments, the state parameters of the target function interface at the different moments, the historical state parameters of the target function interface stored at the different moments and the health state grades at the different moments as training samples to train the health state grade classification model.
2. The method of claim 1, wherein the health status levels comprise at least a high health level or a low health level;
the determining of the request processing mode corresponding to the current health state level of the target function interface includes:
if the current health state grade of the target function interface is a high health grade, determining the request processing mode of the function execution request corresponding to the target function interface as execution;
and if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute.
3. The method of claim 1, wherein the health status levels comprise at least a high health level, a medium health level, or a low health level;
the determining of the request processing mode corresponding to the current health state level of the target function interface includes:
if the current health state grade of the target function interface is a high health grade or a medium health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is execution;
if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute;
if the current health status level of the target function interface is a middle health status, the method further comprises:
and sending a health state alarm notice of the target function interface to a management terminal.
4. The method of claim 1, wherein when the current state parameters of the target functional interface comprise a current thread average response time of the target functional interface, the historical state parameters of the target functional interface comprise: historical thread average response time of the target function interface;
when the current state parameter of the target function interface includes the maximum response time of the current thread of the target function interface, the historical state parameter of the target function interface includes: the maximum response time of the historical thread of the target function interface;
when the current state parameter of the target function interface comprises the current thread minimum response time of the target function interface, the historical state parameter of the target function interface comprises: the historical thread minimum response time of the target function interface;
when the current state parameter of the target function interface includes the current thread number occupied by the target function interface, the historical state parameter of the target function interface includes: and the historical average occupied thread number of the target function interface.
5. An apparatus for processing a function execution request, the apparatus comprising:
the first obtaining module is configured to obtain a current occupancy rate of the processor, current state parameters of a target function interface, and pre-stored historical state parameters of the target function interface, where the current state parameters of the target function interface include one or more of the following: the average response time of the current thread of the target function interface, the maximum response time of the current thread of the target function interface, the minimum response time of the current thread of the target function interface and the number of the currently occupied threads of the target function interface;
the first determination module is used for inputting the occupancy rate, the current state parameter and the historical state parameter into a health state grade classification model trained in advance to obtain the current health state grade of the target function interface, wherein the health state grade classification model is a model established based on a decision tree algorithm;
a second determining module, configured to determine a request processing manner corresponding to the current health status level of the target function interface, where the request processing manner includes execution and execution rejection;
the processing module is used for processing the function execution request corresponding to the target function interface based on the request processing mode;
a second obtaining module, configured to obtain occupancy rates of processors at multiple different times, state parameters of the target function interface at the multiple different times, and historical state parameters of the target function interface stored at the multiple different times;
a third determining module, configured to determine state change parameters of the target function interface at the multiple different times based on the state parameters of the target function interface at the multiple different times and historical state parameters of the target function interface stored at the multiple different times;
a fourth determining module, configured to obtain a first weight corresponding to the occupancy rate and a second weight corresponding to the state change parameter, which are stored in advance, and determine, according to the first weight and the second weight, a weighted value of the occupancy rate and the state change parameter of the processor corresponding to a plurality of different times, as a health state value of the target function interface at the plurality of different times, and determine, according to the health state value of the target function interface at the plurality of different times, a health state rank of the target function interface at the plurality of different times;
and the training module is used for taking the occupancy rates of the processors at the different moments, the state parameters of the target function interface at the different moments, the historical state parameters of the target function interface stored at the different moments and the health state grades at the different moments as training samples to train the health state grade classification model.
6. The apparatus of claim 5, wherein the health status levels comprise at least a high health level or a low health level;
the second determination module is to:
if the current health state grade of the target function interface is a high health grade, determining the request processing mode of the function execution request corresponding to the target function interface as execution;
and if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute.
7. The apparatus of claim 5, wherein the health status levels comprise at least a high health level, a medium health level, or a low health level;
the second determination module is to:
if the current health state grade of the target function interface is a high health grade or a medium health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is execution;
if the current health state grade of the target function interface is a low health grade, determining that the request processing mode of the function execution request corresponding to the target function interface is refused to execute;
if the current health status level of the target function interface is a medium health status, the apparatus is further configured to:
and sending a health state alarm notice of the target function interface to a management terminal.
8. The apparatus of claim 5, wherein when the current state parameters of the target functional interface comprise a current thread average response time of the target functional interface, the historical state parameters of the target functional interface comprise: historical thread average response time of the target function interface;
when the current state parameter of the target function interface includes the maximum response time of the current thread of the target function interface, the historical state parameter of the target function interface includes: the maximum response time of the historical thread of the target function interface;
when the current state parameter of the target function interface comprises the current thread minimum response time of the target function interface, the historical state parameter of the target function interface comprises: the historical thread minimum response time of the target function interface;
when the current state parameter of the target function interface includes the current thread number occupied by the target function interface, the historical state parameter of the target function interface includes: and the historical average occupied thread number of the target function interface.
9. A server, comprising a processor and a memory, the memory having stored therein at least one instruction, the instruction being loaded and executed by the processor to implement a method of processing a function execution request according to any one of claims 1 to 4.
10. A computer-readable storage medium having stored thereon at least one instruction which is loaded and executed by a processor to perform a method of processing a function execution request according to any one of claims 1 to 4.
CN201710959786.3A 2017-10-16 2017-10-16 Method and device for processing function execution request Active CN107678861B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710959786.3A CN107678861B (en) 2017-10-16 2017-10-16 Method and device for processing function execution request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710959786.3A CN107678861B (en) 2017-10-16 2017-10-16 Method and device for processing function execution request

Publications (2)

Publication Number Publication Date
CN107678861A CN107678861A (en) 2018-02-09
CN107678861B true CN107678861B (en) 2020-11-24

Family

ID=61141229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710959786.3A Active CN107678861B (en) 2017-10-16 2017-10-16 Method and device for processing function execution request

Country Status (1)

Country Link
CN (1) CN107678861B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109271290B (en) * 2018-07-27 2022-06-07 广州方硅信息技术有限公司 Method and device for monitoring thread utilization rate and storage device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103701709A (en) * 2013-12-13 2014-04-02 北京京东尚科信息技术有限公司 Flow rate control method and system
CN105335231A (en) * 2014-08-15 2016-02-17 阿里巴巴集团控股有限公司 Dynamic distribution method and device for server threads
CN107247649A (en) * 2016-10-12 2017-10-13 北京奇虎科技有限公司 Method, device and the gateway of detecting system health status

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7908659B2 (en) * 2006-11-10 2011-03-15 Microsoft Corporation Extensible framework for system security state reporting and remediation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103701709A (en) * 2013-12-13 2014-04-02 北京京东尚科信息技术有限公司 Flow rate control method and system
CN105335231A (en) * 2014-08-15 2016-02-17 阿里巴巴集团控股有限公司 Dynamic distribution method and device for server threads
CN107247649A (en) * 2016-10-12 2017-10-13 北京奇虎科技有限公司 Method, device and the gateway of detecting system health status

Also Published As

Publication number Publication date
CN107678861A (en) 2018-02-09

Similar Documents

Publication Publication Date Title
CN108376112B (en) Pressure testing method, device and readable medium
CN109167812B (en) Method for evaluating service quality and determining adjustment strategy, server and storage medium
CN109586952B (en) Server capacity expansion method and device
CN110795203B (en) Resource scheduling method, device, system and computing equipment
CN108234247B (en) Method and system for detecting network quality
CN108111554B (en) Control method and device for access queue
CN108377201A (en) Network Abnormal cognitive method, device, equipment and computer readable storage medium
CN109901881B (en) Plug-in loading method and device of application program, computer equipment and storage medium
CN107943697A (en) Problem distribution method, device, system, server and computer-readable storage medium
CN111860568B (en) Method and device for balanced distribution of data samples and storage medium
CN107678861B (en) Method and device for processing function execution request
CN106294364B (en) Method and device for realizing web crawler to capture webpage
CN109670932B (en) Credit data accounting method, apparatus, system and computer storage medium
CN107612737B (en) Alarm method and device
CN110795324A (en) Data processing method and device
CN112596985B (en) IT asset detection method, device, equipment and medium
CN110119334B (en) Page script monitoring method and device
CN109462510B (en) CDN node quality evaluation method and device
CN117170969A (en) Operation and maintenance method, partition equilibrium recovery device, equipment and medium of server cluster
CN117009221A (en) Processing method, device, equipment, storage medium and program product for product test
CN107357703B (en) Terminal application power consumption detection method and server
CN109921869A (en) Method, apparatus, storage medium and the equipment of the quality of monitoring information transmission channel
CN107562599A (en) A kind of parameter detection method and device
CN110891077A (en) CDN node detection method and device
EP4055780A1 (en) Management of predictive models of a communication network

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