CN108540533A - A kind of method and apparatus of response request - Google Patents
A kind of method and apparatus of response request Download PDFInfo
- Publication number
- CN108540533A CN108540533A CN201810210595.1A CN201810210595A CN108540533A CN 108540533 A CN108540533 A CN 108540533A CN 201810210595 A CN201810210595 A CN 201810210595A CN 108540533 A CN108540533 A CN 108540533A
- Authority
- CN
- China
- Prior art keywords
- api
- access
- time
- failure
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling 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/62—Establishing a time schedule for servicing the requests
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/06—Generation of reports
- H04L43/062—Generation of reports related to network traffic
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/06—Generation of reports
- H04L43/067—Generation of reports using time frame reporting
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/16—Threshold monitoring
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
An embodiment of the present invention provides a kind of response request method and apparatus, the method includes:When terminal device sends access request to server by API, the server obtains the corresponding value values of the API;Judge whether the value values are more than preset times threshold value in predetermined period;When the value values are more than preset times threshold value in predetermined period, then particular message is sent to the corresponding API of the value values;After the particular message is sent to the API, obtains first and access Time To Failure and the second access time;Judge whether the first access Time To Failure and the difference between the second access time are less than preset time threshold;If so, response is used to indicate the access exception information to the API;If it is not, being then directed to the request-reply business normal information;It in the embodiment of the present invention, can prevent the access request in server from blocking, mitigate the pressure to server, avoid the consequence of server delay machine in the case where concurrent access request is excessive.
Description
Technical field
The present invention relates to the technical fields of computer, are asked more particularly to the method and a kind of response of a kind of response request
Device.
Background technology
In the message transmitting procedure of existing terminal device and server, it will usually have multiple terminal devices while send
Access request is to server, and server can pass through API (Application Programming Interface, using journey
Sequence programming interface) receive the access request that multiple terminal devices are sent.
When server response access request issues data to terminal device, it may be necessary to by very time-consuming operation, such as
Complicated data base querying etc., can just get the data for needing to be issued to terminal device, thus, from terminal device
The a large amount of access request of synchronization can cause server very big pressure, or even cause the delay machine of server, reason
It is that concurrent access request is excessive and certain access request elapsed times are long or processor operation is excessively complicated.
Invention content
The embodiment of the present invention provides a kind of device of the method and a kind of corresponding response request of response request, to solve end
The concurrent access request of end equipment is excessive and certain access request elapsed times are long can cause server delay machine it is above-mentioned
Problem.
To solve the above-mentioned problems, the embodiment of the invention discloses a kind of method of response request, the server includes
There is corresponding value values, the server to be connect with terminal device by multiple application programming interface API, the API, institute
The method of stating includes:
When terminal device sends access request to server by API, it is corresponding that the server obtains the API
Value values;
Judge whether the value values are more than preset times threshold value in predetermined period;
When the value values are more than preset times threshold value in predetermined period, then particular message is sent to the value
It is worth corresponding API;
After the particular message is sent to the API, obtains first and access Time To Failure and the second access time;
Judge whether the first access Time To Failure and the difference between the second access time are less than preset time threshold;
If so, response is used to indicate the access exception information to the API;
If it is not, being then directed to the request-reply business normal information.
Preferably, described after the particular message is sent to the API, it obtains first and accesses Time To Failure and the second visit
The step of asking the time further include:
After the particular message is sent to the API, the term of validity of the particular message is obtained;
When the particular message is in the term of validity, obtains first and access Time To Failure and the second access time.
Preferably, the method further includes:
When described first accesses Time To Failure and difference between the second access time is less than preset time threshold, then with
Long connection type forward delay interval access information is to the terminal device.
Preferably, the server includes initialized data base, the initialized data base store the API with it is corresponding
Value values and key values, the value values are used to record the access frequency of failure that terminal device is directed to API.
Preferably, described when described first accesses Time To Failure and the difference between the second access time is less than preset time
When threshold value, then replying the step of being used to indicate the access exception information to the API includes:
When described first accesses Time To Failure and the difference between the second access time is less than preset time threshold, for
The access request of the API of the different business classification received, returns to different access exception information to terminal device.
The embodiment of the invention also discloses a kind of devices of response request, and the server includes multiple API, the API
With corresponding value values, the server is connect with terminal device, and described device includes:
Value value acquisition modules are used for when terminal device sends access request to server by API, the service
Device obtains the corresponding value values of the API;
First judgment module, for judging whether the value values are more than preset times threshold value in predetermined period;
Sending module, for when the value values are more than preset times threshold value in predetermined period, then sending specific disappear
It ceases to the corresponding API of the value values;
Module is obtained, for working as after the particular message is sent to the API, first is obtained and accesses Time To Failure and second
Access time;
Second judgment module, for judging whether described first access Time To Failure and difference between the second access time
Less than preset time threshold;
Access exception information answer module, for when the first access Time To Failure and the difference between the second access time
When value is less than preset time threshold, then the access exception information being used to indicate to the API is replied;
Business normal information responder module, for when the first access Time To Failure and the difference between the second access time
When value is more than preset time threshold, then the request-reply business normal information is directed to.
Preferably, the acquisition module includes:
The term of validity obtains submodule, for working as after the particular message is sent to the API, obtains the particular message
The term of validity;
Submodule is obtained, Time To Failure and second is accessed for when the particular message is in the term of validity, obtaining first
Access time.
Preferably, described device further includes:
Be delayed access information sending module, for when the first access Time To Failure and the difference between the second access time
When value is less than preset time threshold, then with long connection type forward delay interval access information to the terminal device.
Preferably, the server includes initialized data base, the initialized data base store the API with it is corresponding
Value values and key values, the value values are used to record the access frequency of failure that terminal device is directed to API.
Preferably, the access exception information answer module includes:
Access exception information returns to submodule, for when the first access Time To Failure and between the second access time
When difference is less than preset time threshold, for the access request of the API of the different business classification received, different access is returned to
Exception information is to terminal device.
The embodiment of the invention also discloses a kind of electronic equipment, including memory, processor and storage are on a memory simultaneously
The computer program that can be run on a processor, which is characterized in that the processor realizes above-mentioned answer when executing described program
The step of answering request.
The embodiment of the invention also discloses a kind of computer readable storage medium, deposited on the computer readable storage medium
Computer program is contained, the computer program realizes the step of above-mentioned response is asked when being executed by processor.
The embodiment of the present invention includes following advantages:
In the embodiment of the present invention, when terminal device sends access request to server by API, the server obtains
The corresponding value values of the API;Judge whether the value values are more than preset times threshold value;When whether the value values are pre-
If when frequency threshold value, then sending particular message to the corresponding API of the value values;When the particular message is sent to the API
Afterwards, it obtains first and accesses Time To Failure and the second access time;Judge that described first accesses Time To Failure and the second access time
Between difference whether be less than preset time threshold;If so, response is used to indicate the access exception information to the API;If
It is no, then it is directed to the request-reply business normal information;In the embodiment of the present invention, it can prevent the access request in server from hindering
Plug mitigates the pressure to server, avoids the consequence of server delay machine in the case where concurrent access request is excessive.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for
For those of ordinary skill in the art, without creative efforts, other are can also be obtained according to these attached drawings
Attached drawing;
Fig. 1 is a kind of step flow chart of the embodiment of the method one of response request of the embodiment of the present invention;
Fig. 2 is a kind of step flow chart of the embodiment of the method two of response request of the embodiment of the present invention;
Fig. 3 is a kind of structure diagram of the device embodiment of response request of the embodiment of the present invention.
Specific implementation mode
The technical issues of in order to keep the embodiment of the present invention solved, technical solution and advantageous effect are more clearly understood, with
The embodiment of the present invention is further described in lower combination accompanying drawings and embodiments.It should be appreciated that specific implementation described herein
Example is only used to explain the present invention, is not intended to limit the present invention.
Referring to Fig.1, a kind of step flow chart of the embodiment of the method one of response request of the embodiment of the present invention, institute are shown
It states method and is applied to server, the server includes multiple API (application programming interface, Application
Programming Interface), there is the API corresponding value values, the server to be connect with terminal device, specifically
It may include steps of:
Step 101, when terminal device sends access request to server by API, the server obtains the API
Corresponding value values;
In embodiments of the present invention, the server may include PC (personal computer, PC) services
Device, mainframe, minicomputer, can also include Cloud Server, and the embodiment of the present invention does not make specifically the type and quantity of server
Limitation.
It should be noted that the terminal device can be the terminals such as smart mobile phone, tablet computer, can also be that can install
The other-end of application program, such as smartwatch etc., the present invention are not construed as limiting the concrete type of terminal device;The terminal is set
Standby operating system may include Android (Android), IOS, Windows Phone, Windows etc..
In the embodiment of the present invention, the server includes multiple API, and API is some pre-defined functions, and server can
To send data to terminal device by API, terminal device can also send data to server by API.
Specifically, can classify for API according to type of service, for example, which can be from number
The business of data is obtained according to library A, or obtains the business or some time-consuming business etc. calculated of data from database B, i.e., each
API has corresponding type of service, such as terminal device can obtain data with some API from database A.
Further, the server further includes Redis, and Redis is a key-value storage system, i.e. key-
Value databases, in embodiments of the present invention, each API have corresponding key values, and in key-value databases, often
There is a key values corresponding value values, i.e., each API to have corresponding value values;The value values are set for recording terminal
The standby access frequency of failure for being directed to API, when database of the terminal device by some API Access server, if accessing failure,
Then server adds 1 in the corresponding value values of the API, to record the access frequency of failure of API;Specifically, working as terminal device
When sending access request to server by API, the server can get the corresponding value values of API, further judge
Whether the value values are more than preset times threshold value, that is, judge whether terminal device surpasses for the access frequency of failure of each API
Cross given threshold.
Step 102, judge whether the value values are more than preset times threshold value in predetermined period;
Further, after server obtains value values, it can be determined that whether the value values surpass in predetermined period
Preset times threshold value is crossed, i.e. server can judge that the terminal device is for the access frequency of failure of API in predetermined period
No is more than given threshold.
It is set according to actual conditions it should be noted that the preset times threshold value can be those skilled in the art
Any numerical value, such as 12 times, 20 times, the embodiment of the present invention is not restricted this.
Step 103, when the value values are more than preset times threshold value in predetermined period, then particular message is sent extremely
The corresponding API of the value values;
It is specifically applied in the embodiment of the present invention, when some value value is more than default in predetermined period for server judgement
When frequency threshold value, i.e., terminal device has surpassed for the access frequency of failure of the corresponding API of the value values in predetermined period
Given threshold is crossed, then sends particular message to the corresponding API of the value values;For example, if the predetermined period is 5 seconds,
Preset times threshold value is 10 times, and when some value value is more than preset times threshold value (10 times) in 5 seconds, then server is sent out
Send particular message to the corresponding API of the value values.
It should be noted that the particular message can be failed message when business processing operation appearance is abnormal, i.e. table
If show terminal device continue through the API obtain database data may make access request generate accumulation, cause server
The consequences such as delay machine.
Step 104, it after the particular message is sent to the API, obtains first and accesses Time To Failure and the second access
Time;
It applies in the embodiment of the present invention, after the particular message is sent to the API, server can obtain
Terminal device accesses Time To Failure and the second access time for the first of the API;Specifically, the API can record terminal
The access state of equipment, if certain access state be failure, record the time point be first access Time To Failure, then no matter
For the access state of next terminal device for failure or successfully, it is the second access time, server record pair all to record the time point
First answered accesses Time To Failure and the second access time.
It is possible to further which the term of validity of a particular message is arranged;After the particular message is sent to the API,
Server obtains the term of validity of the particular message;Judge the particular message whether in the term of validity;Specific disappear when described
When breath is in the term of validity, obtains first and access Time To Failure and the second access time.
Step 105, it is default to judge whether the first access Time To Failure and the difference between the second access time are less than
Time threshold;
Further, in the case where particular message is in the term of validity, server may determine that described first got
It accesses Time To Failure and whether the difference between the second access time is more than preset time threshold;Specifically, server is first
The first access Time To Failure and the difference between the second access time can be calculated, then judge it is described first access Time To Failure and
Whether the difference between the second access time is less than preset time threshold.
It is set according to actual conditions it should be noted that the preset time threshold can be those skilled in the art
Any time information, the embodiment of the present invention are not restricted this, and the preset time threshold is abnormal cache-time, works as terminal
The access Time To Failure of equipment and the time interval accessed again are smaller, and value values in summary are more than preset times threshold value
The case where, that is, illustrate situations such as API of server there are abnormal conditions, accumulated such as access request.
Step 106, when described first accesses Time To Failure and the difference between the second access time is less than preset time threshold
When value, then the access exception information being used to indicate to the API is replied;
It applies in the embodiment of the present invention, when server judgement described first accesses Time To Failure and second accesses
Between between difference when being less than preset time threshold, then reply and be used to indicate to the access exception information of the API to the end
End equipment, because when described first accesses Time To Failure and the difference between the second access time is less than preset time threshold,
I.e. access request is accumulated in a communication link, influences the processing speed of server, then server can reply access exception information
To the terminal device, in addition, server can also forward delay interval ask to the terminal device, terminal device delay, which is sent, visits
Ask that request to server, in this way, can greatly alleviate server, avoids causing additional pressure to server.
Step 107, when described first accesses Time To Failure and the difference between the second access time is more than preset time threshold
When value, then the request-reply business normal information is directed to.
Further, when described first accesses Time To Failure and the difference between the second access time is more than preset time threshold
When value, then the request-reply business normal information is directed to.
In the embodiment of the present invention, when terminal device sends access request to server by API, the server obtains
The corresponding value values of the API;Judge whether the value values are more than preset times threshold value;When whether the value values are pre-
If when frequency threshold value, then sending particular message to the corresponding API of the value values;When the particular message is sent to the API
Afterwards, it obtains first and accesses Time To Failure and the second access time;Judge that described first accesses Time To Failure and the second access time
Between difference whether be less than preset time threshold;If so, response is used to indicate the access exception information to the API;If
It is no, then it is directed to the request-reply business normal information;In the embodiment of the present invention, it can prevent the access request in server from hindering
Plug mitigates the pressure to server, avoids the consequence of server delay machine in the case where concurrent access request is excessive.
With reference to Fig. 2, a kind of step flow chart of the embodiment of the method two of response request of the embodiment of the present invention, institute are shown
It states method and is applied to server, the server includes multiple API, and the API has corresponding value values, the server
It is connect with terminal device, can specifically include following steps:
Step 201, when terminal device sends access request to server by API, the server obtains the API
Corresponding value values;
It is specifically applied in the embodiment of the present invention, the server includes initialized data base, and the initialized data base can be with
Including key-value databases, i.e., the described initialized data base stores the API and corresponding value values and key values, described
Value values are used to record the access frequency of failure that terminal device is directed to API;And the API can be terminal device access service
The interface of database in device, terminal device can be by the different databases of different API Access, when terminal device passes through
When API sends access request to server, the server obtains the corresponding value values of the API.
Step 202, judge whether the value values are more than preset times threshold value in predetermined period;
Specifically, when server obtain value values after, it can be determined that in predetermined period the value values whether be more than
Preset times threshold value, i.e. server can judge that the terminal device is for the access frequency of failure of each API in predetermined period
Whether it is more than given threshold.
Step 203, when the value values are more than preset times threshold value in predetermined period, then particular message is sent extremely
The corresponding API of the value values;
It is specifically applied in the embodiment of the present invention, when some value value is more than default in predetermined period for server judgement
When frequency threshold value, i.e., terminal device has surpassed for the access frequency of failure of the corresponding API of the value values in predetermined period
Given threshold is crossed, then sends particular message to the corresponding API of the value values.
It should be noted that the particular message can be business processing failed message, each key values have corresponding
Channel (channel), because corresponding to different value values in each API of key-value databases, i.e. server can pass through
Channel sends business processing failed message to the corresponding API of the value values, while to the value values more than predetermined period
It is zeroed out, ensures the accuracy counted, improve the efficiency of response request.
Step 204, after the particular message is sent to the API, the term of validity of the particular message is obtained;
It applies in the embodiment of the present invention, after particular message is sent to the API by server, obtains the spy
Determine the term of validity of message, a time segment information is arranged in the as described particular message, and server may determine that the particular message
Whether in the term of validity.
Step 205, when the particular message is in the term of validity, when obtaining the first access Time To Failure and the second access
Between;
Further, server may determine that the particular message whether in the term of validity, if at the particular message
When the term of validity, server can get the first access Time To Failure and the second access time, and specifically, the API can be with
Record terminal device access state, if certain access state be failure, record the time point be first access failure when
Between, then no matter the access state of next terminal device is to fail or successfully, all record the time point as the second access time.
It should be noted that in embodiments of the present invention, server is the case where the particular message is in the term of validity
Under, it obtains first and accesses Time To Failure and the second access time, can accurately know the abnormal conditions of server access.
Step 206, it is default to judge whether the first access Time To Failure and the difference between the second access time are less than
Time threshold;
It is specifically applied in the embodiment of the present invention, server can calculate the first access Time To Failure and the second access first
Difference between time, then judge whether the first access Time To Failure and the difference between the second access time are less than and preset
Time threshold.
Step 207, when described first accesses Time To Failure and the difference between the second access time is less than preset time threshold
When value, then the access exception information being used to indicate to the API is replied;
When server judges that the first access Time To Failure and the difference between the second access time are less than preset time
When threshold value, then replys and be used to indicate to the access exception information of the API to the terminal device.
It is described when described first accesses Time To Failure and second accesses in a kind of preferred embodiment of the embodiment of the present invention
Between between difference be less than preset time threshold when, then reply the step of being used to indicate the access exception information to the API and wrap
Include following sub-step:
Sub-step S2071, when described first accesses Time To Failure and the difference between the second access time is less than default
Between threshold value when, for receive different business classification API access request, return to different access exception information to terminal
Equipment.
Specifically, when described first accesses Time To Failure and the difference between the second access time is more than preset time threshold
Value, and when by the access request of the API receiving terminal apparatus, it is abnormal that server can pass through the API backward references
Information indicates that server access situation has exception, terminal device that can suspend access server to the terminal device, also,
Server can be directed to the access request of the API of the different business classification received, return to different access exception information to end
End equipment.
In a kind of preferred embodiment of the embodiment of the present invention, when described first access Time To Failure and the second access time it
Between difference be less than preset time threshold when, then with long connection type forward delay interval access information to the terminal device.
Further, when described first accesses Time To Failure and the difference between the second access time is less than preset time threshold
When value, server can also allow terminal device delay to send out with long connection type forward delay interval access information to the terminal device
Send access request to server.
Step 208, when described first accesses Time To Failure and the difference between the second access time is more than preset time threshold
Value is then directed to the request-reply business normal information.
In the embodiment of the present invention, when terminal device sends access request to server by API, the server obtains
The corresponding value values of the API;Judge whether the value values are more than preset times threshold value in predetermined period;When default
When the value values are more than preset times threshold value in period, then particular message is sent to the corresponding API of the value values;Work as institute
It states after particular message is sent to the API, obtains the term of validity of the particular message;Judge the particular message whether in having
In the effect phase;When the particular message is in the term of validity, obtains first and access Time To Failure and the second access time;Described in judgement
Whether the first access Time To Failure and the difference between the second access time are less than preset time threshold;When first access is lost
When losing the difference between time and the second access time less than preset time threshold, then the visit being used to indicate to the API is replied
Ask exception information;Time To Failure is accessed and difference between the second access time is more than preset time threshold when described first, then
For the request-reply business normal information;So that terminal device delay is sent access request, is obtained by postponing business datum
Processing mode prevent the access request in server from blocking, avoid server and delay in the case where concurrent access request is excessive
The consequence of machine mitigates the pressure to server, improves the efficiency of response request.
It should be noted that for embodiment of the method, for simple description, therefore it is all expressed as a series of action group
It closes, but those skilled in the art should understand that, the embodiment of the present invention is not limited by the described action sequence, because according to
According to the embodiment of the present invention, certain steps can be performed in other orders or simultaneously.Secondly, those skilled in the art also should
Know, embodiment described in this description belongs to preferred embodiment, and the involved action not necessarily present invention is implemented
Necessary to example.
With reference to Fig. 3, a kind of structure diagram of the device embodiment of response request of the embodiment of the present invention, the clothes are shown
Business device includes multiple application programming interface API, and the API has corresponding value values, the server and terminal device
Connection, can specifically include following module:
Value values acquisition module 301 is used for when terminal device sends access request to server by API, the clothes
Business device obtains the corresponding value values of the API;
First judgment module 302, for judging whether the value values are more than preset times threshold value in predetermined period;
Sending module 303, for when the value values are more than preset times threshold value in predetermined period, then sending spy
Message is determined to the corresponding API of the value values;
Obtain module 304, for working as after the particular message is sent to the API, obtain first access Time To Failure and
Second access time;
Second judgment module 305, for judging that described first accesses Time To Failure and the difference between the second access time
Whether preset time threshold is less than;
Access exception information answer module 306, for when the first access Time To Failure and between the second access time
Difference be less than preset time threshold when, then reply the access exception information being used to indicate to the API;
Business normal information responder module 307, for when the first access Time To Failure and between the second access time
Difference be more than preset time threshold when, then be directed to the request-reply business normal information.
Preferably, the acquisition module includes:
The term of validity obtains submodule, for working as after the particular message is sent to the API, obtains the particular message
The term of validity;
Submodule is obtained, Time To Failure and second is accessed for when the particular message is in the term of validity, obtaining first
Access time.
Preferably, described device further includes:
Be delayed access information sending module, for when the first access Time To Failure and the difference between the second access time
When value is less than preset time threshold, then with long connection type forward delay interval access information to the terminal device.
Preferably, the server includes initialized data base, the initialized data base store the API with it is corresponding
Value values and key values, the value values are used to record the access frequency of failure that terminal device is directed to API.
Preferably, the access exception information sending module includes:
Access exception information returns to submodule, for when the first access Time To Failure and between the second access time
When difference is less than preset time threshold, for the access request of the API of the different business classification received, different access is returned to
Exception information is to terminal device.
The embodiment of the invention also discloses a kind of electronic equipment, including memory, processor and storage are on a memory simultaneously
The computer program that can be run on a processor, which is characterized in that the processor realizes above-mentioned answer when executing described program
The step of answering request.
The embodiment of the invention also discloses a kind of computer readable storage medium, deposited on the computer readable storage medium
Computer program is contained, the computer program realizes the step of above-mentioned response is asked when being executed by processor.
For device embodiments, since it is basically similar to the method embodiment, so fairly simple, the correlation of description
Place illustrates referring to the part of embodiment of the method.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with
The difference of other embodiment, the same or similar parts between the embodiments can be referred to each other.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can be provided as method, apparatus or calculate
Machine program product.Therefore, the embodiment of the present invention can be used complete hardware embodiment, complete software embodiment or combine software and
The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can be used one or more wherein include computer can
With in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code
The form of the computer program product of implementation.
The embodiment of the present invention be with reference to according to the method for the embodiment of the present invention, terminal device (system) and computer program
The flowchart and/or the block diagram of product describes.It should be understood that flowchart and/or the block diagram can be realized by computer program instructions
In each flow and/or block and flowchart and/or the block diagram in flow and/or box combination.These can be provided
Computer program instructions are set to all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminals
Standby processor is to generate a machine so that is held by the processor of computer or other programmable data processing terminal equipments
Capable instruction generates for realizing in one flow of flow chart or multiple flows and/or one box of block diagram or multiple boxes
The device of specified function.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing terminal equipments
In computer-readable memory operate in a specific manner so that instruction stored in the computer readable memory generates packet
The manufacture of command device is included, which realizes in one flow of flow chart or multiple flows and/or one side of block diagram
The function of being specified in frame or multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing terminal equipments so that
Series of operation steps are executed on computer or other programmable terminal equipments to generate computer implemented processing, thus
The instruction executed on computer or other programmable terminal equipments is provided for realizing in one flow of flow chart or multiple flows
And/or in one box of block diagram or multiple boxes specify function the step of.
Although the preferred embodiment of the embodiment of the present invention has been described, once a person skilled in the art knows bases
This creative concept, then additional changes and modifications can be made to these embodiments.So the following claims are intended to be interpreted as
Including preferred embodiment and fall into all change and modification of range of embodiment of the invention.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning
Covering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements not only wrap
Those elements are included, but also include other elements that are not explicitly listed, or further include for this process, method, article
Or the element that terminal device is intrinsic.In the absence of more restrictions, being wanted by what sentence "including a ..." limited
Element, it is not excluded that there is also other identical elements in process, method, article or the terminal device including the element.
Above to a kind of device of the method and a kind of response request of response request provided by the present invention, carry out in detail
It introduces, principle and implementation of the present invention are described for specific case used herein, the explanation of above example
It is merely used to help understand the method and its core concept of the present invention;Meanwhile for those of ordinary skill in the art, according to this
The thought of invention, there will be changes in the specific implementation manner and application range, in conclusion the content of the present specification is not answered
It is interpreted as limitation of the present invention.
Claims (10)
1. a kind of method of response request, which is characterized in that server includes multiple application programming interface API, the API
With corresponding value values, the server is connect with terminal device, the method includes:
When terminal device sends access request to server by API, the server obtains the corresponding value of the API
Value;
Judge whether the value values are more than preset times threshold value in predetermined period;
When the value values are more than preset times threshold value in predetermined period, then particular message is sent to the value values pair
The API answered;
After the particular message is sent to the API, obtains first and access Time To Failure and the second access time;
Judge whether the first access Time To Failure and the difference between the second access time are less than preset time threshold;
If so, response is used to indicate the access exception information to the API;
If it is not, being then directed to the request-reply business normal information.
2. according to the method described in claim 1, it is characterized in that, described after the particular message is sent to the API, obtain
The step of taking the first access Time To Failure and the second access time further include:
After the particular message is sent to the API, the term of validity of the particular message is obtained;
When the particular message is in the term of validity, obtains first and access Time To Failure and the second access time.
3. according to the method described in claim 1, it is characterized in that, the method further includes:
When described first accesses Time To Failure and the difference between the second access time is less than preset time threshold, then connected with long
Mode forward delay interval access information is connect to the terminal device.
4. according to the method described in claim 1, it is characterized in that, the server includes initialized data base, the preset number
The API and corresponding value values and key values are stored according to library, the value values are used to record the visit that terminal device is directed to API
Ask the frequency of failure.
5. according to the method described in claim 1, it is characterized in that, described when described first accesses Time To Failure and the second access
When difference between time is less than preset time threshold, then the step of being used to indicate the access exception information to the API is replied
Including:
When described first accesses Time To Failure and the difference between the second access time is less than preset time threshold, for reception
The access request of the API for the different business classification arrived, returns to different access exception information to terminal device.
6. a kind of device of response request, which is characterized in that the server includes multiple API, and the API has corresponding
Value values, the server are connect with terminal device, and described device includes:
Value value acquisition modules, for when terminal device sends access request to server by API, the server to obtain
Take the corresponding value values of the API;
First judgment module, for judging whether the value values are more than preset times threshold value in predetermined period;
Sending module, for when the value values are more than preset times threshold value in predetermined period, then sending particular message extremely
The corresponding API of the value values;
Module is obtained, for working as after the particular message is sent to the API, first is obtained and accesses Time To Failure and second access
Time;
Second judgment module, for judging whether the first access Time To Failure and the difference between the second access time are less than
Preset time threshold;
Access exception information answer module is small for the difference when the first access Time To Failure and between the second access time
When preset time threshold, then the access exception information being used to indicate to the API is replied;
Business normal information responder module is big for the difference when the first access Time To Failure and between the second access time
When preset time threshold, then the request-reply business normal information is directed to.
7. device according to claim 6, which is characterized in that the acquisition module includes:
The term of validity obtains submodule, for working as after the particular message is sent to the API, obtains the effective of the particular message
Phase;
Submodule is obtained, Time To Failure and the second access are accessed for when the particular message is in the term of validity, obtaining first
Time.
8. device according to claim 6, which is characterized in that described device further includes:
Be delayed access information sending module, small for the difference when the first access Time To Failure and between the second access time
When preset time threshold, then with long connection type forward delay interval access information to the terminal device.
9. a kind of electronic equipment, including memory, processor and storage are on a memory and the calculating that can run on a processor
Machine program, which is characterized in that the processor realizes answering as described in any one of claim 1 to 5 when executing described program
The step of answering request.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium
Program realizes the step of the response request as described in any one of claim 1 to 5 when the computer program is executed by processor
Suddenly.
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 true CN108540533A (en) | 2018-09-14 |
CN108540533B 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) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110108705A (en) * | 2019-05-17 | 2019-08-09 | 深圳市东盈讯达电子有限公司 | A kind of data measuring method and relevant apparatus |
CN110166965A (en) * | 2019-04-24 | 2019-08-23 | 中国联合网络通信集团有限公司 | The performance method for early warning and equipment of online charging system |
CN110580234A (en) * | 2019-08-22 | 2019-12-17 | 广州易起行信息技术有限公司 | Fusing method suitable for micro server and external system |
CN111193760A (en) * | 2019-07-18 | 2020-05-22 | 腾讯科技(深圳)有限公司 | Information sending method, device and storage medium |
CN111930719A (en) * | 2020-08-13 | 2020-11-13 | 中国工商银行股份有限公司 | Database access method, device and system |
CN114945003A (en) * | 2022-05-31 | 2022-08-26 | 济南浪潮数据技术有限公司 | Control method, device, equipment and medium for avoiding message blocking network |
Citations (7)
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 |
US20120233668A1 (en) * | 2011-03-08 | 2012-09-13 | Rackspace Us, Inc. | Pluggable Allocation in a Cloud Computing System |
US20120278473A1 (en) * | 2011-04-27 | 2012-11-01 | Rackspace Us, Inc. | Event Queuing and Distribution System |
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 |
-
2018
- 2018-03-14 CN CN201810210595.1A patent/CN108540533B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120233668A1 (en) * | 2011-03-08 | 2012-09-13 | Rackspace Us, Inc. | Pluggable Allocation in a Cloud Computing System |
US20120278473A1 (en) * | 2011-04-27 | 2012-11-01 | Rackspace Us, Inc. | Event Queuing and Distribution System |
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 |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110166965A (en) * | 2019-04-24 | 2019-08-23 | 中国联合网络通信集团有限公司 | The performance method for early warning and equipment of online charging system |
CN110108705A (en) * | 2019-05-17 | 2019-08-09 | 深圳市东盈讯达电子有限公司 | A kind of data measuring method and relevant apparatus |
CN111193760A (en) * | 2019-07-18 | 2020-05-22 | 腾讯科技(深圳)有限公司 | Information sending method, device and storage medium |
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 |
CN111930719A (en) * | 2020-08-13 | 2020-11-13 | 中国工商银行股份有限公司 | Database access method, device and system |
CN111930719B (en) * | 2020-08-13 | 2023-09-19 | 中国工商银行股份有限公司 | Database access method, device and system |
CN114945003A (en) * | 2022-05-31 | 2022-08-26 | 济南浪潮数据技术有限公司 | Control method, device, equipment and medium for avoiding message blocking network |
CN114945003B (en) * | 2022-05-31 | 2024-02-13 | 济南浪潮数据技术有限公司 | Control method, device, equipment and medium for avoiding message blocking network |
Also Published As
Publication number | Publication date |
---|---|
CN108540533B (en) | 2021-01-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108540533A (en) | A kind of method and apparatus of response request | |
CN109586969A (en) | Content distributing network disaster recovery method, device, computer equipment and storage medium | |
CN109873863B (en) | Asynchronous calling method and device of service | |
CN108900640A (en) | Node calls link generation method, device, computer equipment and storage medium | |
CN112311628B (en) | Network speed measuring method, system, network equipment and storage medium | |
CN110958161B (en) | Block chain link point monitoring method and device and storage medium | |
CN113242297B (en) | Service system and service state adjusting method | |
CN104579765A (en) | Disaster tolerance method and device for cluster system | |
CN110784336A (en) | Multi-device intelligent timing delay scene setting method and system based on Internet of things | |
CN108366098B (en) | Data interaction method and device for network nodes | |
WO2017007981A1 (en) | Action correlation framework | |
CN106686040A (en) | Message processing method and message processing device | |
CN109933508B (en) | Method and apparatus for transmitting information | |
CN110908910A (en) | Block chain-based test monitoring method and device and readable storage medium | |
CN106899504B (en) | Cross-cluster service routing method and device | |
CN113726885A (en) | Method and device for adjusting flow quota | |
CN112612848A (en) | Method, device and system for real-time data synchronization, electronic equipment and storage medium | |
CN111769965B (en) | Information processing method, device and equipment | |
CN106470225B (en) | A kind of notification message management method and device | |
CN109933413A (en) | Service implementation method and device, electronic equipment, storage medium | |
CN115168489B (en) | Data certification method and device based on blockchain | |
CN113225228B (en) | Data processing method and device | |
CN110852537A (en) | Service quality detection method and device | |
CN115208789B (en) | Method and device for determining directory blasting behavior, electronic equipment and storage medium | |
CN110347632B (en) | Communication method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |