CN108540533B - Request answering method and device - Google Patents

Request answering method and device Download PDF

Info

Publication number
CN108540533B
CN108540533B CN201810210595.1A CN201810210595A CN108540533B CN 108540533 B CN108540533 B CN 108540533B CN 201810210595 A CN201810210595 A CN 201810210595A CN 108540533 B CN108540533 B CN 108540533B
Authority
CN
China
Prior art keywords
access
time
api
value
server
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
CN201810210595.1A
Other languages
Chinese (zh)
Other versions
CN108540533A (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.)
Qingdao Hisense Media Network Technology Co Ltd
Original Assignee
Qingdao Hisense Media Network 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 Qingdao Hisense Media Network Technology Co Ltd filed Critical Qingdao Hisense Media Network Technology Co Ltd
Priority to CN201810210595.1A priority Critical patent/CN108540533B/en
Publication of CN108540533A publication Critical patent/CN108540533A/en
Application granted granted Critical
Publication of CN108540533B publication Critical patent/CN108540533B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/62Establishing a time schedule for servicing the requests
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/06Generation of reports
    • H04L43/062Generation of reports related to network traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/06Generation of reports
    • H04L43/067Generation of reports using time frame reporting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring

Landscapes

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

Abstract

The embodiment of the invention provides a method and a device for responding a request, wherein the method comprises the following steps: when terminal equipment sends an access request to a server through an API, the server acquires a value corresponding to the API; judging whether the value exceeds a preset time threshold value in a preset period; when the value exceeds a preset time threshold value in a preset period, sending a specific message to an API corresponding to the value; after the specific message is sent to the API, acquiring first access failure time and second access time; judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not; if yes, responding to access exception information used for indicating the API; if not, responding to the normal information of the service aiming at the request; according to the embodiment of the invention, the blocking of the access requests in the server can be prevented, the pressure on the server is reduced, and the effect that the server is down under the condition of excessive concurrent access requests is avoided.

Description

Request answering method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for responding to a request.
Background
In the process of transmitting information between a terminal device and a server in the prior art, a plurality of terminal devices generally transmit access requests to the server at the same time, and the server may receive the access requests transmitted by the plurality of terminal devices through an Application Programming Interface (API).
When the server responds to the access request to send data to the terminal device, time-consuming operations, such as complex database query, may be required to obtain the data to be sent to the terminal device, so that a large number of access requests from the terminal device at the same time may cause a great deal of stress on the server, and even cause a downtime of the server, because of too many concurrent access requests, too long time consumption of some access requests, or too complex operation of the processor.
Disclosure of Invention
Embodiments of the present invention provide a method for responding to a request and a corresponding device for responding to a request, so as to solve the above-mentioned problems that a server is down due to too many concurrent access requests of a terminal device and too long time consumption of some access requests.
In order to solve the above problem, an embodiment of the present invention discloses a method for responding to a request, where the server includes multiple application programming interfaces APIs, where the APIs have corresponding value values, and the server is connected to a terminal device, and the method includes:
when terminal equipment sends an access request to a server through an API, the server acquires a value corresponding to the API;
judging whether the value exceeds a preset time threshold value in a preset period;
when the value exceeds a preset time threshold value in a preset period, sending a specific message to an API corresponding to the value;
after the specific message is sent to the API, acquiring first access failure time and second access time;
judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not;
if yes, responding to access exception information used for indicating the API;
if not, responding to the normal information of the service aiming at the request.
Preferably, the step of obtaining the first access failure time and the second access time after the specific message is sent to the API further includes:
after the specific message is sent to the API, obtaining the validity period of the specific message;
and when the specific message is in the validity period, acquiring first access failure time and second access time.
Preferably, the method further comprises:
and when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, sending delayed access information to the terminal equipment in a long connection mode.
Preferably, the server includes a preset database, and the preset database stores the API and a value and a key value corresponding to the API, where the value is used to record the number of access failures of the terminal device to the API.
Preferably, when the difference between the first access failure time and the second access time is smaller than a preset time threshold, the step of responding to the access exception information indicating the access exception to the API includes:
and when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, returning different access abnormal information to the terminal equipment aiming at the received access requests of the API of different service classifications.
The embodiment of the invention also discloses a device for responding the request, the server comprises a plurality of APIs (application programming interfaces), the APIs have corresponding value values, the server is connected with the terminal equipment, and the device comprises:
the value acquisition module is used for acquiring a value corresponding to an API (application program interface) by a server when the terminal equipment sends an access request to the server through the API;
the first judgment module is used for judging whether the value exceeds a preset time threshold value in a preset period;
the sending module is used for sending a specific message to an API corresponding to the value when the value exceeds a preset time threshold value in a preset period;
the obtaining module is used for obtaining first access failure time and second access time after the specific message is sent to the API;
the second judgment module is used for judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not;
an access exception information response module, configured to, when a difference between the first access failure time and the second access time is smaller than a preset time threshold, respond access exception information indicating that the access to the API is to be performed;
and the service normal information response module is used for responding the service normal information aiming at the request when the difference value between the first access failure time and the second access time is greater than a preset time threshold value.
Preferably, the obtaining module includes:
the validity period obtaining submodule is used for obtaining the validity period of the specific message after the specific message is sent to the API;
and the obtaining submodule is used for obtaining the first access failure time and the second access time when the specific message is in the validity period.
Preferably, the apparatus further comprises:
and the delayed access information sending module is used for sending the delayed access information to the terminal equipment in a long connection mode when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value.
Preferably, the server includes a preset database, and the preset database stores the API and a value and a key value corresponding to the API, where the value is used to record the number of access failures of the terminal device to the API.
Preferably, the access exception information response module includes:
and the access exception information returning submodule is used for returning different access exception information to the terminal equipment according to the received access requests of the API with different service classifications when the difference value between the first access failure time and the second access time is smaller than a preset time threshold.
The embodiment of the invention also discloses electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and is characterized in that the step of responding to the request is realized when the processor executes the program.
The embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program realizes the steps of responding to the request when being executed by a processor.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, when terminal equipment sends an access request to a server through an API, the server acquires a value corresponding to the API; judging whether the value exceeds a preset time threshold value or not; when the value is not preset for a threshold value, sending a specific message to an API corresponding to the value; after the specific message is sent to the API, acquiring first access failure time and second access time; judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not; if yes, responding to access exception information used for indicating the API; if not, responding to the normal information of the service aiming at the request; according to the embodiment of the invention, the blocking of the access requests in the server can be prevented, the pressure on the server is reduced, and the effect that the server is down under the condition of excessive concurrent access requests is avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts;
FIG. 1 is a flowchart illustrating steps of a first embodiment of a method for responding to a request according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a second embodiment of a method for responding to a request according to the present invention;
fig. 3 is a block diagram of an embodiment of a device for responding to a request according to an embodiment of the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects solved by the embodiments of the present invention more clearly apparent, the embodiments of the present invention are described in further detail below with reference to the accompanying drawings and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, a flowchart of a first step of a method embodiment for responding to a request according to the embodiment of the present invention is shown, where the method is applied to a server, where the server includes multiple APIs (Application Programming interfaces), the APIs have corresponding value values, and the server is connected to a terminal device, and specifically includes the following steps:
step 101, when a terminal device sends an access request to a server through an API, the server acquires a value corresponding to the API;
in the embodiment of the present invention, the server may include a PC (personal computer) server, a mainframe, a mini-machine, and a cloud server, and the type and the number of the servers are not specifically limited in the embodiment of the present invention.
It should be noted that the terminal device may be a terminal such as a smart phone, a tablet computer, or other terminals capable of installing an application program, such as a smart watch, and the specific type of the terminal device is not limited in the present invention; the operating system of the terminal device may include Android (Android), IOS, Windows Phone, Windows, and the like.
In the embodiment of the invention, the server comprises a plurality of APIs (application programming interfaces), the APIs are some predefined functions, the server can send data to the terminal equipment through the APIs, and the terminal equipment can also send data to the server through the APIs.
Specifically, the APIs may be classified according to service types, for example, the service type may be a service of acquiring data from the database a, a service of acquiring data from the database B, or a certain time-consuming calculation service, that is, each API has a service type corresponding to it, for example, a terminal device may acquire data from the database a with a certain API.
Further, the server further includes Redis, where Redis is a key-value storage system, i.e., a key-value database, and in the embodiment of the present invention, each API has a corresponding key value, and in the key-value database, each key value has a corresponding value, i.e., each API has a corresponding value; the value is used for recording the access failure times of the terminal equipment aiming at the API, when the terminal equipment accesses a database of the server through a certain API, if the access fails, the server adds 1 to the value corresponding to the API so as to record the access failure times of the API; specifically, when the terminal device sends an access request to the server through the API, the server may obtain a value corresponding to the API, and further determine whether the value exceeds a preset threshold, that is, determine whether the access failure times of the terminal device for each API exceed a set threshold.
Step 102, judging whether the value exceeds a preset time threshold value in a preset period;
further, after the server obtains the value, it may be determined whether the value exceeds a preset threshold, that is, the server may determine whether the access failure times of the terminal device to the API within the preset period exceeds a set threshold.
It should be noted that the preset number threshold may be any value set by a person skilled in the art according to practical situations, such as 12 times and 20 times, and the embodiment of the present invention is not limited thereto.
103, when the value exceeds a preset time threshold value in a preset period, sending a specific message to an API corresponding to the value;
specifically, when the server determines that a value exceeds a preset threshold, that is, the access failure times of the terminal device to the API corresponding to the value within a preset period exceed a set threshold, the server sends a specific message to the API corresponding to the value; for example, if the preset period is 5 seconds, the preset time threshold is 10 times, and when a value exceeds the preset time threshold (10 times) within 5 seconds, the server sends a specific message to the API corresponding to the value.
It should be noted that the specific message may be a failure message when the service processing operation is abnormal, that is, it indicates that if the terminal device continues to acquire the data in the database through the API, the access request may be accumulated, and as a result, the server may be down.
Step 104, after the specific message is sent to the API, acquiring first access failure time and second access time;
in practical application to the embodiment of the present invention, after the specific message is sent to the API, the server may obtain a first access failure time and a second access time of the terminal device for the API; specifically, the API may record the access state of the terminal device, and if the access state of a certain time is a failure, record the time point as the first access failure time, record the time point as the second access time no matter the access state of the terminal device is a failure or a success next time, and record the corresponding first access failure time and the second access time by the server.
Further, the validity period of a specific message may be set; after the specific message is sent to the API, the server obtains the validity period of the specific message; judging whether the specific message is in the validity period or not; and when the specific message is in the validity period, acquiring first access failure time and second access time.
Step 105, judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value;
further, under the condition that the specific message is in the validity period, the server may determine whether the difference between the acquired first access failure time and the acquired second access time is greater than a preset time threshold; specifically, the server may first calculate a difference between the first access failure time and the second access time, and then determine whether the difference between the first access failure time and the second access time is smaller than a preset time threshold.
It should be noted that the preset time threshold may be any time information set by a person skilled in the art according to an actual situation, and the embodiment of the present invention is not limited to this, where the preset time threshold is an abnormal cache time, and when the access failure time of the terminal device and the time interval of the re-access are smaller, the value exceeds the preset time threshold, that is, it is described that the API of the server has an abnormal situation, such as a stacked access request.
Step 106, when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, responding to access abnormal information for indicating the API;
in practical application to the embodiment of the present invention, when the server determines that the difference between the first access failure time and the second access time is smaller than the preset time threshold, the server responds to the access exception information indicating the access exception to the API to the terminal device, because when the difference between the first access failure time and the second access time is smaller than the preset time threshold, that is, the access request is accumulated in the communication link, which affects the processing speed of the server, the server may respond to the access exception information to the terminal device, and in addition, the server may also send a delay request to the terminal device, which delays sending the access request to the server, so that the server may be greatly relieved, and additional pressure on the server may be avoided.
And 107, when the difference value between the first access failure time and the second access time is greater than a preset time threshold value, responding to the request for responding to the normal service information.
Further, when the difference between the first access failure time and the second access time is greater than a preset time threshold, responding to the request for the normal service information.
In the embodiment of the invention, when terminal equipment sends an access request to a server through an API, the server acquires a value corresponding to the API; judging whether the value exceeds a preset time threshold value or not; when the value is not preset for a threshold value, sending a specific message to an API corresponding to the value; after the specific message is sent to the API, acquiring first access failure time and second access time; judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not; if yes, responding to access exception information used for indicating the API; if not, responding to the normal information of the service aiming at the request; according to the embodiment of the invention, the blocking of the access requests in the server can be prevented, the pressure on the server is reduced, and the effect that the server is down under the condition of excessive concurrent access requests is avoided.
Referring to fig. 2, a flowchart illustrating a step of a second embodiment of a method for responding to a request according to an embodiment of the present invention is shown, where the method is applied to a server, the server includes multiple APIs, the APIs have corresponding value values, and the server is connected to a terminal device, and specifically includes the following steps:
step 201, when a terminal device sends an access request to a server through an API, the server obtains a value corresponding to the API;
specifically, in the embodiment of the present invention, the server includes a preset database, where the preset database may include a key-value database, that is, the preset database stores the API and a value and a key value corresponding to the API, where the value is used to record the number of access failures of the terminal device to the API; the API may be an interface for the terminal device to access a database in the server, the terminal device may access different databases through different APIs, and when the terminal device sends an access request to the server through the API, the server obtains a value corresponding to the API.
Step 202, judging whether the value exceeds a preset time threshold value in a preset period;
specifically, after the server obtains the value, it may be determined whether the value exceeds a preset threshold, that is, the server may determine whether the access failure times of the terminal device for each API within a preset period exceeds a set threshold.
Step 203, when the value exceeds a preset time threshold value in a preset period, sending a specific message to an API corresponding to the value;
specifically, when the server determines that a value exceeds a preset threshold, that is, the number of access failures of the terminal device to the API corresponding to the value within a preset period exceeds a set threshold, the server sends a specific message to the API corresponding to the value.
It should be noted that the specific message may be a service processing failure message, each key value has a corresponding channel (channel), and each API corresponds to a different value in the key-value database, that is, the server may send the service processing failure message to the API corresponding to the value through the channel, and clear the value exceeding the preset period at the same time, so as to ensure the accuracy of counting and improve the efficiency of responding to the request.
Step 204, after the specific message is sent to the API, obtaining the validity period of the specific message;
in practical application to the embodiment of the present invention, after the server sends the specific message to the API, the validity period of the specific message is obtained, that is, a time period information is set for the specific message, and the server may determine whether the specific message is within the validity period.
Step 205, when the specific message is in the validity period, acquiring a first access failure time and a second access time;
further, the server may determine whether the specific message is within the validity period, and if the specific message is within the validity period, the server may obtain the first access failure time and the second access time, specifically, the API may record the access state of the terminal device, and if the access state of a certain time is a failure, record the time point as the first access failure time, and record the time point as the second access time no matter the access state of the terminal device is a failure or a success next time.
It should be noted that, in the embodiment of the present invention, the server acquires the first access failure time and the second access time when the specific message is in the validity period, so that the abnormal condition of the server access can be accurately known.
Step 206, judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value;
specifically, in the embodiment of the present invention, the server may first calculate a difference between the first access failure time and the second access time, and then determine whether the difference between the first access failure time and the second access time is smaller than a preset time threshold.
Step 207, when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, responding to access exception information for indicating the API;
and when the server judges that the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, responding to access abnormal information for indicating the API to the terminal equipment.
In a preferred embodiment of the present invention, when the difference between the first access failure time and the second access time is smaller than a preset time threshold, the step of responding to the access exception information indicating the access exception to the API includes the following sub-steps:
and a substep S2071, returning different access exception information to the terminal device according to the received access request of the API with different service classes when the difference between the first access failure time and the second access time is smaller than a preset time threshold.
Specifically, when the difference between the first access failure time and the second access time is greater than the preset time threshold and the access request of the terminal device is received through the API, the server may return access exception information to the terminal device through the API, which indicates that the access condition of the server is abnormal, the terminal device may suspend accessing the server, and the server may return different access exception information to the terminal device for the received access request of the API with different service classifications.
In a preferred embodiment of the present invention, when a difference between the first access failure time and the second access time is smaller than a preset time threshold, the delayed access information is sent to the terminal device in a long connection manner.
Further, when the difference between the first access failure time and the second access time is smaller than the preset time threshold, the server may further send delayed access information to the terminal device in a long connection manner, so that the terminal device sends an access request to the server in a delayed manner.
And step 208, when the difference between the first access failure time and the second access time is greater than a preset time threshold, responding to the request for responding to the normal service information.
In the embodiment of the invention, when terminal equipment sends an access request to a server through an API, the server acquires a value corresponding to the API; judging whether the value exceeds a preset time threshold value in a preset period; when the value exceeds a preset time threshold value in a preset period, sending a specific message to an API corresponding to the value; after the specific message is sent to the API, obtaining the validity period of the specific message; judging whether the specific message is in the validity period or not; when the specific message is in the validity period, acquiring first access failure time and second access time; judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not; when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, responding to access abnormal information for indicating the API; when the difference value between the first access failure time and the second access time is larger than a preset time threshold value, responding to the request for responding to the normal service information; the terminal equipment is enabled to send the access request in a delayed mode, the access request in the server is prevented from being blocked by the processing mode of suspending the service data acquisition, the result that the server goes down under the condition that the concurrent access requests are too many is avoided, the pressure on the server is reduced, and the efficiency of responding the request is improved.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 3, a block diagram illustrating a structure of an embodiment of a device for responding to a request according to an embodiment of the present invention is shown, where the server includes multiple application programming interfaces APIs, the APIs have corresponding value values, and the server is connected to the terminal device, and specifically includes the following modules:
a value obtaining module 301, configured to, when a terminal device sends an access request to a server through an API, obtain, by the server, a value corresponding to the API;
a first determining module 302, configured to determine whether the value exceeds a preset time threshold in a preset period;
a sending module 303, configured to send a specific message to an API corresponding to the value when the value exceeds a preset threshold for times in a preset period;
an obtaining module 304, configured to obtain a first access failure time and a second access time after the specific message is sent to the API;
a second determining module 305, configured to determine whether a difference between the first access failure time and the second access time is smaller than a preset time threshold;
an access exception information response module 306, configured to, when a difference between the first access failure time and the second access time is smaller than a preset time threshold, respond access exception information indicating that the access to the API is abnormal;
a service normality information response module 307, configured to respond to the request for service normality information when a difference between the first access failure time and the second access time is greater than a preset time threshold.
Preferably, the obtaining module includes:
the validity period obtaining submodule is used for obtaining the validity period of the specific message after the specific message is sent to the API;
and the obtaining submodule is used for obtaining the first access failure time and the second access time when the specific message is in the validity period.
Preferably, the apparatus further comprises:
and the delayed access information sending module is used for sending the delayed access information to the terminal equipment in a long connection mode when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value.
Preferably, the server includes a preset database, and the preset database stores the API and a value and a key value corresponding to the API, where the value is used to record the number of access failures of the terminal device to the API.
Preferably, the access exception information sending module includes:
and the access exception information returning submodule is used for returning different access exception information to the terminal equipment according to the received access requests of the API with different service classifications when the difference value between the first access failure time and the second access time is smaller than a preset time threshold.
The embodiment of the invention also discloses electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and is characterized in that the step of responding to the request is realized when the processor executes the program.
The embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program realizes the steps of responding to the request when being executed by a processor.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method for responding to a request and the device for responding to a request provided by the present invention are described in detail above, and the principle and the implementation of the present invention are explained in the present document by applying specific examples, and the description of the above examples is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method of responding to a request, wherein a server includes a plurality of application programming interfaces, APIs, the APIs having corresponding value values, the server being connected to a terminal device, the method comprising:
when terminal equipment sends an access request to a server through an API, the server acquires a value corresponding to the API;
judging whether the value exceeds a preset time threshold value in a preset period;
when the value exceeds a preset time threshold value in a preset period, sending a specific message to an API corresponding to the value;
after the specific message is sent to the API, acquiring first access failure time and second access time; the first access failure time is a time point corresponding to access with a failure state when the terminal equipment accesses the API; the second access time is a time point corresponding to the next access of the first access failure time;
judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not;
if yes, responding to access exception information used for indicating the API;
if not, responding to the normal information of the service aiming at the request.
2. The method of claim 1, wherein the step of obtaining the first access failure time and the second access time after the specific message is sent to the API further comprises:
after the specific message is sent to the API, obtaining the validity period of the specific message;
and when the specific message is in the validity period, acquiring first access failure time and second access time.
3. The method of claim 1, further comprising:
and when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, sending delayed access information to the terminal equipment in a long connection mode.
4. The method according to claim 1, wherein the server comprises a preset database, and the preset database stores the API and corresponding value and key value, and the value is used for recording the access failure times of the terminal device for the API.
5. The method of claim 1, wherein the step of responding to the access exception information indicating the access exception to the API when the difference between the first access failure time and the second access time is less than a preset time threshold comprises:
and when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value, returning different access abnormal information to the terminal equipment aiming at the received access requests of the API of different service classifications.
6. An apparatus for responding to a request, wherein a server includes a plurality of APIs, the APIs having corresponding value values, and the server is connected to a terminal device, the apparatus comprising:
the value acquisition module is used for acquiring a value corresponding to an API (application program interface) by a server when the terminal equipment sends an access request to the server through the API;
the first judgment module is used for judging whether the value exceeds a preset time threshold value in a preset period;
the sending module is used for sending a specific message to an API corresponding to the value when the value exceeds a preset time threshold value in a preset period;
the obtaining module is used for obtaining first access failure time and second access time after the specific message is sent to the API; the first access failure time is a time point corresponding to access with a failure state when the terminal equipment accesses the API; the second access time is a time point corresponding to the next access of the first access failure time;
the second judgment module is used for judging whether the difference value between the first access failure time and the second access time is smaller than a preset time threshold value or not;
an access exception information response module, configured to, when a difference between the first access failure time and the second access time is smaller than a preset time threshold, respond access exception information indicating that the access to the API is to be performed;
and the service normal information response module is used for responding the service normal information aiming at the request when the difference value between the first access failure time and the second access time is greater than a preset time threshold value.
7. The apparatus of claim 6, wherein the obtaining module comprises:
the validity period obtaining submodule is used for obtaining the validity period of the specific message after the specific message is sent to the API;
and the obtaining submodule is used for obtaining the first access failure time and the second access time when the specific message is in the validity period.
8. The apparatus of claim 6, further comprising:
and the delayed access information sending module is used for sending the delayed access information to the terminal equipment in a long connection mode when the difference value between the first access failure time and the second access time is smaller than a preset time threshold value.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of answering a request according to any of claims 1 to 5 are implemented by the processor when executing the program.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of answering a request according to any one of claims 1 to 5.
CN201810210595.1A 2018-03-14 2018-03-14 Request answering method and device Active CN108540533B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810210595.1A CN108540533B (en) 2018-03-14 2018-03-14 Request answering method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810210595.1A CN108540533B (en) 2018-03-14 2018-03-14 Request answering method and device

Publications (2)

Publication Number Publication Date
CN108540533A CN108540533A (en) 2018-09-14
CN108540533B true CN108540533B (en) 2021-01-22

Family

ID=63483567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810210595.1A Active CN108540533B (en) 2018-03-14 2018-03-14 Request answering method and device

Country Status (1)

Country Link
CN (1) CN108540533B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110166965B (en) * 2019-04-24 2021-05-18 中国联合网络通信集团有限公司 Performance early warning method and device of online charging system
CN110108705A (en) * 2019-05-17 2019-08-09 深圳市东盈讯达电子有限公司 A kind of data measuring method and relevant apparatus
CN111193760B (en) * 2019-07-18 2022-01-07 腾讯科技(深圳)有限公司 Information sending method, device and storage medium
CN110580234A (en) * 2019-08-22 2019-12-17 广州易起行信息技术有限公司 Fusing method suitable for micro server and external system
CN111930719B (en) * 2020-08-13 2023-09-19 中国工商银行股份有限公司 Database access method, device and system
CN114945003B (en) * 2022-05-31 2024-02-13 济南浪潮数据技术有限公司 Control method, device, equipment and medium for avoiding message blocking network

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102279786A (en) * 2011-08-25 2011-12-14 百度在线网络技术(北京)有限公司 Method and device for monitoring effective access amount of application program
CN104284356A (en) * 2014-10-13 2015-01-14 大唐移动通信设备有限公司 Method and system for judging network quality
CN104933105A (en) * 2015-05-29 2015-09-23 北京奇虎科技有限公司 Analysis method and device for database access request
CN106936623A (en) * 2015-12-31 2017-07-07 五八同城信息技术有限公司 The management method of distributed cache system and cache cluster
CN107544850A (en) * 2016-06-29 2018-01-05 百度在线网络技术(北京)有限公司 Method and apparatus for controlling distributed lock

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9141410B2 (en) * 2011-03-08 2015-09-22 Rackspace Us, Inc. Pluggable allocation in a cloud computing system
US8751639B2 (en) * 2011-04-27 2014-06-10 Rackspace Us, Inc. Event queuing and distribution system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102279786A (en) * 2011-08-25 2011-12-14 百度在线网络技术(北京)有限公司 Method and device for monitoring effective access amount of application program
CN104284356A (en) * 2014-10-13 2015-01-14 大唐移动通信设备有限公司 Method and system for judging network quality
CN104933105A (en) * 2015-05-29 2015-09-23 北京奇虎科技有限公司 Analysis method and device for database access request
CN106936623A (en) * 2015-12-31 2017-07-07 五八同城信息技术有限公司 The management method of distributed cache system and cache cluster
CN107544850A (en) * 2016-06-29 2018-01-05 百度在线网络技术(北京)有限公司 Method and apparatus for controlling distributed lock

Also Published As

Publication number Publication date
CN108540533A (en) 2018-09-14

Similar Documents

Publication Publication Date Title
CN108540533B (en) Request answering method and device
CN107544832B (en) Method, device and system for monitoring process of virtual machine
CN110647460B (en) Test resource management method and device and test client
US11341842B2 (en) Metering data management system and computer readable recording medium
CN110069217B (en) Data storage method and device
CN111245897A (en) Data processing method, device, system, storage medium and processor
US20150205675A1 (en) Method and System for Improving Reliability of a Background Page
CN111125168B (en) Data processing method and device, electronic equipment and storage medium
CN111078418B (en) Operation synchronization method, device, electronic equipment and computer readable storage medium
CN115934378A (en) Service data processing method and device, electronic equipment and storage medium
KR102464688B1 (en) Method and apparatus for detrmining event level of monitoring result
CN115033927A (en) Method, device, equipment and medium for detecting data integrity
CN110113187B (en) Configuration updating method and device, configuration server and configuration system
CN112965791A (en) Timing task detection method, device, equipment and storage medium
CN110908886A (en) Data sending method and device, electronic equipment and storage medium
CN111352992B (en) Data consistency detection method, device and server
CN115208789B (en) Method and device for determining directory blasting behavior, electronic equipment and storage medium
KR20230100901A (en) Edge service management apparatus and control method thereof
CN109063206B (en) Article monitoring method and device
US10701178B2 (en) Method and apparatus of web application server for blocking a client session based on a threshold number of service calls
KR20220055661A (en) Edge service processing system and control method thereof
CN116594818A (en) Method, device and equipment for detecting configuration consistency of application system
CN117075916A (en) Application deployment method, device, equipment and storage medium
CN116795531A (en) Resource scheduling method and device, electronic equipment and storage medium
KR20230075076A (en) System and method for non-disruptive transmitting log using message queue

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