CN110557398A - Service request control method, device, system, computer equipment and storage medium - Google Patents
Service request control method, device, system, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110557398A CN110557398A CN201910864333.1A CN201910864333A CN110557398A CN 110557398 A CN110557398 A CN 110557398A CN 201910864333 A CN201910864333 A CN 201910864333A CN 110557398 A CN110557398 A CN 110557398A
- Authority
- CN
- China
- Prior art keywords
- request
- service
- identifier
- file
- target
- 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/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- 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/63—Routing a service request depending on the request content or context
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
Abstract
the application relates to a service request control method, device, system, computer equipment and storage medium. The method comprises the following steps: pulling a target identification file from a server; obtaining waiting stop time corresponding to a plurality of service request identifications; adjusting the waiting stop time according to the target identification file; determining a service request identifier corresponding to the adjusted waiting stop time as a target request identifier; and stopping waiting for the service request response corresponding to the target request identification. By adopting the method, the communication resources can be saved, and the waste of the communication resources is effectively avoided.
Description
Technical Field
the present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a system, a computer device, and a storage medium for controlling a service request.
background
with the development of computer technology, a terminal can request a service from a server through a network. In the process of requesting a service, a terminal usually establishes a connection with a server, and transmits messages such as a service request and a response result through the established connection. After sending out the service request, the terminal starts to wait for the server response. Even if the server is abnormal, the terminal can continuously wait for response, and the communication resources of the terminal are wasted.
In a conventional manner, a terminal controls a service request by determining whether a connection established between the terminal and a server is interrupted. When the connection is interrupted, the terminal stops waiting for a response. However, when other abnormality occurs, for example, when the connection is normal but the terminal does not receive the response result due to the transfer abnormality, the terminal may still wait in the conventional manner. Therefore, the conventional method causes waste of communication resources. For example, it may cause unnecessary thread resources to be blocked while the terminal waits for a response.
Disclosure of Invention
In view of the above, it is necessary to provide a service request control method, apparatus, system, computer device and storage medium capable of saving communication resources in order to solve the above technical problem of communication resource waste.
A service request control method, the method comprising:
pulling a target identification file from a server;
Obtaining waiting stop time corresponding to a plurality of service request identifications;
Adjusting the waiting stop time according to the target identification file;
Determining a service request identifier corresponding to the adjusted waiting stop time as a target request identifier;
and stopping waiting for the service request response corresponding to the target request identification.
In one embodiment, the pulling the target identification file from the server includes:
Sending a file acquisition request to the server according to a preset frequency, wherein the file acquisition request carries a client identifier;
and receiving a target identification file corresponding to the client identification returned by the server according to the file acquisition request, wherein the target identification file comprises a to-be-processed request identification corresponding to the service calling request in the server.
in one embodiment, the sending the file acquisition request to the server according to the preset frequency includes:
Packaging the file acquisition request in a detection data packet generated according to a connection detection instruction;
sending the detection data packet to the server, and receiving a response data packet returned by the server;
and analyzing the response data packet to obtain the target identification file.
In one embodiment, the method further comprises:
generating a service request identifier corresponding to the service calling request according to the service calling request;
and sending the service call request carrying the service request identifier and the client identifier to the server, so that the server updates a target identifier file corresponding to the client identifier according to the service request identifier.
In one embodiment, before obtaining the waiting stop time corresponding to the plurality of service request identifiers, the method further includes:
acquiring the sending time corresponding to the service calling request and the request waiting time;
determining the waiting stop time according to the sending time and the request waiting time;
And associating and storing the service request identifier corresponding to the service calling request with the waiting stop time.
in one embodiment, the obtaining of the sending time corresponding to the service invocation request and the request waiting duration includes:
Acquiring the waiting times corresponding to the service calling request;
Calculating the pulling interval duration corresponding to the target identification file according to the preset frequency;
And determining the request waiting time corresponding to the service calling request according to the waiting times and the pulling interval time.
In one embodiment, the adjusting the waiting stop time according to the target identifier file includes:
Reading a request identifier to be processed in the target identifier file;
Acquiring file pulling time corresponding to the target identification file;
Determining target stop time corresponding to the request identifier to be processed according to the file pulling time and the request waiting time;
Comparing the request identifier to be processed with the service request identifier;
And replacing the waiting stop time corresponding to the service request identifier consistent with the request identifier to be processed with the target stop time.
A service request control method, the method comprising:
receiving a file acquisition request uploaded by a terminal;
Analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request;
Acquiring a target identification file corresponding to the client identification, wherein the target identification file comprises a to-be-processed request identification corresponding to a service calling request in a server;
and returning the target identification file to the terminal, so that the terminal adjusts the corresponding waiting stop time according to the request identification to be processed, and waits for a service request response according to the adjusted waiting stop time.
In one embodiment, the method further comprises:
Receiving the service calling request uploaded by the terminal, wherein the service calling request carries the client identifier and a service request identifier corresponding to the service calling request;
And updating the target identification file corresponding to the client identification according to the service request identification.
In one embodiment, the step of updating the target identity file corresponding to the client identity according to the service request identity includes:
Marking the service request identifier as the request identifier to be processed, and recording the service request identifier in a target identifier file corresponding to the client identifier;
Executing a service calling request corresponding to the request identifier to be processed;
And after a service request response corresponding to the request identifier to be processed is returned to the terminal, deleting the request identifier to be processed from the target identifier file.
a service request control apparatus, the apparatus comprising:
the file pulling module is used for pulling the target identification file from the server;
the time acquisition module is used for acquiring waiting stop time corresponding to the service request identifications;
The time adjusting module is used for adjusting the waiting stop time according to the target identification file;
The identification determining module is used for determining a service request identification corresponding to the adjusted waiting stop time as a target request identification;
And the waiting stopping module is used for stopping waiting for the service request response corresponding to the target request identifier.
A service request control apparatus, the apparatus comprising:
The request receiving module is used for receiving a file acquisition request uploaded by the terminal;
The request analysis module is used for analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request;
The file acquisition module is used for acquiring a target identification file corresponding to the client identification, wherein the target identification file comprises a to-be-processed request identification corresponding to a service calling request in a server;
And the request control module is used for returning the target identification file to the terminal, so that the terminal adjusts the corresponding waiting stop time according to the to-be-processed request identification and waits for a service request response according to the adjusted waiting stop time.
A service request control system, the system comprising:
The server is used for receiving a file acquisition request uploaded by the terminal; analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request; acquiring a target identification file corresponding to the client identification, wherein the target identification file comprises a to-be-processed request identification corresponding to a service calling request in a server; returning the target identification file to the terminal;
The terminal is used for pulling the target identification file from the server; obtaining waiting stop time corresponding to a plurality of service request identifications; adjusting the waiting stop time according to the target identification file; determining a service request identifier corresponding to the adjusted waiting stop time as a target request identifier; and stopping waiting for the service request response corresponding to the target request identification.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the above-described service request control method when executing the computer program.
a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned service request control method.
according to the service request control method, the device, the system, the computer equipment and the storage medium, the target identification file is pulled from the server, the waiting stop time corresponding to the service request identifications is adjusted according to the target identification file, and the waiting stop time corresponding to the service request identifications can be flexibly adjusted according to the request processing condition of the server. And after the adjusted waiting stop time is reached, the service request response corresponding to the target request identifier is stopped in time, so that the communication resources are saved, and the waste of the communication resources is effectively avoided.
Drawings
FIG. 1 is a diagram of an application environment of a service request control method in one embodiment;
FIG. 2 is a flow diagram illustrating a method for service request control in one embodiment;
FIG. 3 is a flowchart illustrating the steps of adjusting the wait for stop time based on the target identification file in one embodiment;
FIG. 4 is a flowchart illustrating a service request control method according to another embodiment;
FIG. 5 is a block diagram showing the construction of a service request control apparatus according to an embodiment;
FIG. 6 is a block diagram showing the construction of a service request control apparatus according to another embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The service request control method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The terminal 102 pulls the target identification file from the server 104. The terminal 102 obtains the waiting stop time corresponding to the plurality of service request identifiers, and adjusts the waiting stop time according to the target identifier file. The terminal 102 determines the service request identifier corresponding to the adjusted waiting stop time as the target request identifier. The terminal 102 stops waiting for the service request response corresponding to the target request identification. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a service request control method is provided, which is described by taking the method as an example applied to the terminal 102 in fig. 1, and includes the following steps:
Step 202, pulling the target identification file from the server.
The terminal may correspond to one or more clients, and the clients may run on an operating system of the terminal. The client is an application program corresponding to the server and providing a service to the user. The client can provide local service for the user, and can call the corresponding server to provide corresponding service through the communication connection established between the terminal and the server.
the server includes a plurality of identification files, which may be stored in a database of the server. The terminal can pull the target identification file from a plurality of identification files stored in the server database. Specifically, the client running on the terminal includes a corresponding client identifier, and a correspondence exists between an identifier file stored in the server and the client identifier. The terminal can pull the target identification file corresponding to the client identification from the database of the server according to the client identification corresponding to the running client.
the target identification file records a to-be-processed request identification corresponding to the service call request which is being processed or waiting to be processed by the server. The service calling request is sent to the server by the terminal through a communication connection with the server. The service calling request carries a corresponding client identifier. After receiving the service calling request uploaded by the terminal, the server records the to-be-processed request identifier corresponding to the service calling request in the target identifier file corresponding to the client identifier, and correspondingly processes the service calling request.
step 204, obtaining the waiting stop time corresponding to the service request identifications.
Before sending the service calling request to the server, the terminal may generate a corresponding service request identifier according to the service calling request. The service invocation request may be triggered to be generated according to the actual requirements of the client. For example, the service invocation request may be generated by a user through a terminal by manually triggering a client control, or may be generated by automatically triggering according to actual requirements during the operation process of the client. The service request identification may be one of a variety of identifications used to tag service invocation requests. For example, the service request Identifier may be a UUID (Universally Unique Identifier) corresponding to the service invocation request, including a time-based UUID, a name-based UUID, a randomly generated UUID, and the like.
when the terminal uploads the service calling request to the server, the corresponding service request identifier generated according to the service calling request is recorded, and the waiting stop time corresponding to the service calling request is determined. The waiting stop time may be determined according to the time when the corresponding service invocation request is sent and the waiting duration corresponding to the service invocation request. And the terminal associates the service request identifier corresponding to the uploaded service calling request with the waiting stop time. The terminal can store the service request identifier, the waiting stop time and the association relationship in the memory, so that the terminal can stop waiting for the corresponding service request response according to the waiting stop time corresponding to the service request identifier.
the terminal may store the service request identification and the wait for stop time in various forms. For example, the terminal may record the service request identifier and the waiting stop time in the form of a list, and store the list in the memory. Wherein the terminal can record all service request identities in the same list. The list may also correspond to client identifiers, each client corresponding to a respective list. That is, the terminal may record the service request identifier and the wait stop time in the list corresponding to the client identifier according to the client identifier of the service invocation request. The terminal can obtain a plurality of service request identifications recorded locally and the waiting stop time corresponding to each service request identification.
And step 206, adjusting the waiting stop time according to the target identification file.
the terminal reads a to-be-processed request identifier in a target identifier file pulled from the server, wherein the to-be-processed request identifier is an identifier corresponding to a service call request which is being processed by the server or is prepared to be processed in a queue. The terminal can compare the request identifier to be processed in the target identifier file with the plurality of locally recorded service request identifiers, and adjust the waiting stop time corresponding to the service request identifier according to the comparison result.
Specifically, the terminal compares the pending request identifier with the service request identifier, and determines whether a service request identifier consistent with the pending request identifier in the target identifier file exists in the plurality of service request identifiers. And when the service request identification has consistent to-be-processed request identification, determining that the comparison is successful, and adjusting the waiting stop time corresponding to the service request identification. And when the service request identifier does not have a consistent request identifier to be processed, determining that the comparison fails, and not adjusting the waiting stop time corresponding to the service request identifier.
The terminal can obtain the file pulling time when the target identification file is pulled from the server, and adjust the waiting stop time corresponding to the successful service request identification according to the file pulling time comparison. And the terminal calculates the corresponding target stop time according to the file pulling time and the waiting duration, and replaces the waiting stop time corresponding to the service request identifier with the target stop time to obtain the adjusted waiting stop time. The terminal compares the same service request identification in the target identification file pulled from the server, and determines that the server is processing or preparing to process the service call request corresponding to the service request identification. The terminal adjusts the waiting stop time corresponding to the service request identifier according to the file pulling time, only adjusts the waiting stop time corresponding to the service request identifier which is being processed or is ready to be processed by the server, and flexibly adjusts the time for the terminal to wait for the server to respond.
and step 208, determining the service request identifier corresponding to the adjusted waiting stop time as a target request identifier.
the terminal may traverse the adjusted wait stop time corresponding to the service request identifier, and determine the service request identifier corresponding to the adjusted wait stop time as the target request identifier. Specifically, the terminal may obtain the current time according to a certain frequency, and traverse the adjusted waiting stop time by using the current time. The frequency of the terminal acquiring the current time may be the same as the frequency of pulling the target identification file, or may be different from the frequency of pulling the target identification file.
the terminal judges whether the adjusted waiting stop time reaches the current time of the traversal time. And when the adjusted waiting stop time reaches the current time, determining the service request identifier corresponding to the waiting stop time as a target request identifier. And when the adjusted waiting stop time does not reach the current time of the traversal time, the terminal continuously waits for the service request response of the service request identifier corresponding to the waiting stop time which does not reach the current time.
Step 210, stopping waiting for the service request response corresponding to the target request identifier.
after traversing the adjusted waiting stop time, when the service request identifier is recorded as the target request identifier, the terminal stops waiting for the service request response corresponding to the target request identifier, and releases the communication resource occupied when waiting for the server response, thereby avoiding the waste of the terminal communication resource. Specifically, the terminal may release the communication resource occupied correspondingly according to the transmission mode with the server.
for example, when the terminal and the server perform synchronous transmission, after the service call request is uploaded to the server, the terminal may block the request thread, and return a response result after the server responds to the service call request. When the server is abnormal and does not respond to the service call request any more, it is meaningless to continuously block the request thread to wait for the response, and unnecessary thread resources are occupied. And the terminal stops waiting for the service request response corresponding to the target request identifier, releases the corresponding request thread and avoids the waste of thread resources. When asynchronous transmission is performed between the terminal and the server, the terminal can also stop waiting for a service request response corresponding to the target request identifier and stop waiting for a callback result.
In one embodiment, the terminal may generate a prompt message corresponding to the stop-and-wait service request response, and write the prompt message as a response result into the request thread or the callback request object, so as to prompt that the target request identifier corresponds to the failure of the service call request response.
In this embodiment, the terminal may face abnormal situations such as connection interruption with the server, abnormal restart of the server, and failure of the terminal due to the server returning a response result but transmitting an abnormality. The terminal pulls the target identification file from the server, adjusts the waiting stop time corresponding to the plurality of service request identifications recorded locally according to the target identification file, and can flexibly adjust the waiting stop time corresponding to the service request identification according to the request processing condition of the server. And traversing the waiting stop time by the terminal by using the current time to determine whether the service request identifier reaches the corresponding waiting stop time. And after the adjusted waiting stop time is reached, the terminal stops waiting for the service request response corresponding to the target request identifier in time, so that the waste of terminal communication resources is avoided, and the communication resources of the terminal are effectively saved.
in an embodiment, the step of pulling the target identification file from the server includes: sending a file acquisition request to a server according to a preset frequency, wherein the file acquisition request carries a client identifier; and receiving a target identification file corresponding to the client identification returned by the server according to the file acquisition request, wherein the target identification file comprises a to-be-processed request identification corresponding to the service calling request in the server.
And the terminal pulls the target identification file from the server according to the preset frequency. Specifically, the terminal sends a file acquisition request to the server according to a preset frequency. The preset frequency is a fixed frequency for adjusting the waiting stop time by pulling the target identification file preset by the user through the terminal. For example, the preset frequency may be set to once a second.
the file acquisition request carries a client identifier and is used for pulling a target identifier file corresponding to the client identifier from the server. After receiving a file acquisition request uploaded by a terminal, the server analyzes the file acquisition request to obtain a client identifier carried in the file acquisition request. And the server acquires a target identification file corresponding to the client identification from the database according to the file acquisition request. The database of the server may store a target identification file corresponding to each of the plurality of client identifiers, where the target identification file is used to record a to-be-processed request identifier corresponding to a service invocation request uploaded by a terminal through a client corresponding to the client identifier. And the server returns the acquired target identification file to the terminal. And the terminal receives a response result returned by the server according to the file acquisition request to obtain the target identification file.
In this embodiment, the terminal sends a file acquisition request to the server according to a preset frequency, and acquires a target identification file in the server. The terminal acquires the request processing condition of the server in real time according to the preset frequency, and adjusts the waiting stop time corresponding to the service request identifier according to the acquired target identifier file, so that the accuracy of the waiting stop time is effectively improved, unnecessary waiting of the terminal for the server to respond to the service calling request is avoided, and the communication resources of the terminal are saved.
in one embodiment, sending the file acquisition request to the server according to the preset frequency includes: encapsulating the file acquisition request in a detection data packet generated according to the connection detection instruction; sending a detection data packet to a server, and receiving a response data packet returned by the server; and analyzing the response data packet to obtain a target identification file.
the terminal can also encapsulate the file acquisition request in a detection data packet, and pull the target identification file from the server when sending the detection data packet to the server according to the connection detection instruction. The connection detection command may be a ping (Packet Internet Groper) command. And the server checks whether the connection with the terminal is disconnected or not according to the connection detection instruction, and returns a response data packet to the terminal under the condition of keeping the connection. The target identification file may be carried in a response packet returned by the server according to the ping command. The terminal can receive the response data packet, analyze the response data packet returned by the server and obtain the target identification file from the response data packet
In this embodiment, the terminal pulls the target identification file while detecting the communication connection with the server, thereby effectively improving the efficiency of pulling the target identification file from the server.
in one embodiment, the service request control method further includes: generating a service request identifier corresponding to the service calling request according to the service calling request; and sending the service call request carrying the service request identifier and the client identifier to a server, so that the server updates a target identifier file corresponding to the client identifier according to the service request identifier.
The service Call request uploaded by the terminal may be a Remote service Call request based on RPC (Remote Procedure Call). The terminal can generate a service calling request according to the requirement of the client. The terminal can generate a service calling request when the control corresponding to the client is triggered. For example, a user may trigger a control corresponding to the client through the terminal, so that the terminal invokes a service on the server. The terminal can also automatically generate a service calling request according to the actual requirement in the running process of the client. For example, when the client needs to verify the user identity in the operation process, the terminal automatically generates a service invocation request under the condition that the user does not sense, so that the server verifies the user identity.
And the terminal generates a corresponding service request identifier according to the service calling request. The service request identification may be one of a variety of identifications used to tag service invocation requests. For example, the service request Identifier may be a UUID (Universally Unique Identifier) corresponding to the service invocation request, including a time-based UUID, a name-based UUID, a randomly generated UUID, and the like. The terminal can generate the service request identifier corresponding to the service invoking request in various ways. For example, the terminal may use SHA1(Secure Hash Algorithm) to generate a service request identifier corresponding to the request. The terminal may also generate the service request identifier according to data such as a current timestamp, a random number, and a Media Access Control (MAC) address of the terminal. The terminal can also generate a service request identifier corresponding to the service call request according to a preset mapping relation.
the service call request generated by the terminal carries the corresponding service request identifier and the client identifier, and the terminal sends the service call request to the server so as to call the corresponding service from the server. And after receiving the service calling request uploaded by the terminal, the server analyzes the service calling request and records the service request identifier carried in the service calling request into a target identifier file corresponding to the client identifier. Each client identifier in the server has a corresponding target identifier file, and the target identifier file may be stored in a database corresponding to the server. The server may respond to the received service invocation request, perform processing corresponding to the service invocation request, and obtain a processing result. And the server returns the processing result to the corresponding terminal and deletes the corresponding service request identifier from the target identifier file.
In this embodiment, the service call request carries the service request identifier and the client identifier, so that the server records the service request identifier in a target identifier file corresponding to the client identifier, and deletes the service request identifier from the target identifier file after responding to the service call request. The target identification file records the service request identification corresponding to the service call request which is being processed or is ready to be processed by the server, so that the request processing condition in the server can be clearly and accurately represented, and the waiting stop time corresponding to the service request identification can be accurately adjusted according to the target identification file.
In an embodiment, before the step of obtaining the waiting stop time corresponding to the plurality of service request identifiers, the service request control method further includes: acquiring sending time corresponding to a service calling request and request waiting time; determining waiting stop time according to the sending time and the request waiting duration; and associating and storing the service request identifier corresponding to the service calling request with the waiting stop time.
and when the terminal sends the service calling request to the server, acquiring the sending time corresponding to the service calling request. The terminal can obtain the corresponding request waiting duration according to the service calling request, and the request waiting duration represents the time length that the terminal can keep waiting for the response state. The request wait period may be a fixed period, such as 4 seconds. The service calling request can also be changed correspondingly, and different request waiting time lengths can be corresponded to different service calling requests. For example, more important or complex service invocation requests may correspond to longer request latency.
And the terminal determines the corresponding waiting stop time according to the sending time and the request waiting time corresponding to the service calling request. Specifically, the terminal may obtain the waiting stop time by extending the request waiting time from the sending time. And when the waiting stop time is reached, the terminal stops waiting for the server to respond to the service calling request.
And the terminal determines the association relationship between the service request identifier corresponding to the service calling request and the waiting stop time. Specifically, the terminal may record, in the form of a list, a service request identifier and wait stop time corresponding to the service invocation request, and an association relationship between the service request identifier and the wait stop time. The terminal may store the list in local memory. And when the terminal receives a response result returned by the server within the waiting stop time, deleting the service request identifier corresponding to the response result from the list. And when the waiting for the service request response corresponding to the target request identifier is stopped, the target request identifier can be deleted from the list, so that the data volume stored by the terminal is reduced.
In this embodiment, the terminal may determine the waiting stop time according to the sending time and the request waiting time corresponding to the service invocation request, flexibly and accurately determine the time for the terminal to wait for the response of the server, and avoid that the terminal occupies the communication resource for a long time under an abnormal condition. The terminal associates the service request identifier with the waiting stop time, so that the terminal can control the service call request corresponding to the service request identifier according to the association relationship between the service request identifier and the waiting stop time.
in an embodiment, the step of obtaining the sending time corresponding to the service invocation request and the request waiting duration includes: acquiring the waiting times corresponding to the service calling request; calculating pull interval duration corresponding to the target identification file according to a preset frequency; and determining the request waiting time corresponding to the service calling request according to the waiting times and the pulling interval time.
the terminal can obtain the waiting times corresponding to the service calling request, wherein the waiting times refer to the times that the service calling request can wait for the terminal to pull the target identification file. The waiting times may be fixed and consistent, for example, the waiting times of the service invocation request sent by the terminal are all 4 times. The number of times of waiting for the plurality of service invocation requests may also be different. For example, the terminal may set different wait times for different service invocation requests, and the more important or complex service invocation requests may correspond to more wait times.
the terminal can calculate the pulling interval duration corresponding to the target identification file according to the preset frequency of pulling the target identification file. The pulling interval duration represents the interval duration between two adjacent times of pulling the target identification file from the server by the terminal. For example, when the preset frequency of the terminal pulling the target identification file is once per second, the corresponding pulling interval duration is one second. When the preset frequency of the terminal for pulling the target identification file is twice per second, the corresponding pulling interval duration is 0.5 second.
The terminal can determine the request waiting time corresponding to the service calling request according to the waiting times corresponding to the service calling request and the pulling interval time. The terminal can calculate the product of the waiting times and the pulling interval duration, add a fixed duration, and use the calculated time length as the request waiting duration corresponding to the service call request. Wherein the request waiting duration represents a length of time that the terminal can maintain a waiting response state. The fixed duration is the base wait duration. The fixed duration is used for adjusting time corresponding to a target identification file pulled by the terminal for the last time and basic response time of the server when the waiting time is 0. The fixed duration is a fixed and unchanging length of time. For example, when the number of waiting times corresponding to the service invocation request is 4, the pulling interval duration of the terminal pulling the target identification file is 1 second, and the fixed duration is 0.5 second, the terminal may calculate that the request waiting duration corresponding to the service invocation request is 4.5 seconds.
in this embodiment, the terminal may obtain different request waiting durations for different service invocation requests by obtaining the waiting times corresponding to the service invocation request and the pull interval duration for pulling the target identification file. The terminal can flexibly determine the corresponding request waiting time according to different service calling requests, effectively improves the flexibility of the service request waiting time and controls the accuracy of the service calling requests.
in an embodiment, as shown in fig. 3, the step of adjusting the waiting stop time according to the target identification file includes:
step 302, reading the pending request identifier in the target identifier file.
And step 304, acquiring the file pulling time corresponding to the target identification file.
and step 306, determining the target stop time corresponding to the request identifier to be processed according to the file pulling time and the request waiting time.
Step 308, comparing the pending request id with the service request id.
step 310, replacing the waiting stop time corresponding to the service request identifier consistent with the pending request identifier with the target stop time.
And after the terminal pulls the target identification file from the server, reading the to-be-processed request identification recorded in the target identification file. The pending request identifier is an identifier corresponding to a service invocation request being processed by the server or being prepared for processing in the queue. The terminal obtains the file pulling time when the target identification file is pulled from the server, and the terminal can determine the target stop time corresponding to the request identification to be processed according to the file pulling time and the request waiting time corresponding to the request identification to be processed.
Specifically, the to-be-processed request identifier in the target identifier file is recorded in the target identifier file by the server according to the received service request identifier. The terminal has a request waiting duration corresponding to the service request identifier consistent with the pending request identifier, and the terminal can determine the target stopping time corresponding to the pending request identifier in the same manner as the waiting stopping time. It is understood that the target stop time corresponds to updating the sending time corresponding to the pending request identification to the file pull time. The terminal can update the sending time corresponding to the request identifier to be processed according to the file pulling time of the target identifier file which is pulled last time every time the target identifier file is pulled.
The terminal can compare the request identifier to be processed in the target identifier file with the plurality of locally recorded service request identifiers, and adjust the waiting stop time corresponding to the service request identifier according to the comparison result. Specifically, the terminal compares the pending request identifier with the service request identifier, and determines whether a service request identifier consistent with the pending request identifier in the target identifier file exists in the plurality of service request identifiers.
And when the service request identification has consistent to-be-processed request identification, determining that the comparison is successful, and adjusting the waiting stop time corresponding to the service request identification. The terminal may replace the waiting stop time corresponding to the service request identifier consistent with the pending request identifier with the target stop time corresponding to the pending request identifier. And when the service request identifier does not have a consistent request identifier to be processed, determining that the comparison fails, and not adjusting the waiting stop time corresponding to the service request identifier until the waiting stop time is reached, and stopping waiting for the service request response corresponding to the service request identifier.
in this embodiment, the terminal may read the pending request identifier in the target identifier file, where the pending request identifier in the target identifier file indicates a service invocation request being processed or being prepared for processing by the server. The terminal replaces the waiting stop time corresponding to the service request identifier consistent with the request identifier to be processed with the target stop time, and the terminal can prolong the corresponding waiting stop time for the service call request which is being processed or is ready to be processed by the server. The terminal can flexibly adjust the waiting stop time corresponding to the service request identifier according to the request processing condition of the server, and stop waiting for the service request response corresponding to the target request identifier in time, so that the communication resource is saved, and the waste of the communication resource is effectively avoided.
In one embodiment, as shown in fig. 4, a service request control method is provided, which is described by taking the method as an example applied to the server 104 in fig. 1, and includes the following steps:
Step 402, receiving a file acquisition request uploaded by a terminal.
Step 404, analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request.
Step 406, a target identification file corresponding to the client identifier is obtained, where the target identification file includes a to-be-processed request identifier corresponding to the service invocation request in the server.
and step 408, returning the target identification file to the terminal, so that the terminal adjusts the corresponding waiting stop time according to the request identification to be processed, and waits for the service request response according to the adjusted waiting stop time.
The terminal can pull the identification file from the server according to the preset frequency. Specifically, the terminal may send a file acquisition request to the server according to a preset frequency. The preset frequency is a fixed frequency for adjusting the waiting stop time by pulling the target identification file preset by the user through the terminal. For example, the preset frequency may be set to once a second. The server can receive a file acquisition request uploaded by the terminal.
the server can analyze the file acquisition request after receiving the file acquisition request uploaded by the terminal, so as to obtain the client identifier carried in the file acquisition request. The terminal may correspond to one or more clients, and the clients may run on an operating system of the terminal. The client is an application program corresponding to the server and providing a service to the user. The client can provide local service for the user, and can call the corresponding server to provide corresponding service through the communication connection established between the terminal and the server.
The server includes a plurality of identification files, which may be stored in a database of the server. The identification file may be used to record a request identification corresponding to a service invocation request being processed or being prepared for processing by the server. A corresponding relationship exists between each identification file and the client identification running on the terminal, namely, a request identification of the service call request uploaded by the client corresponding to the client identification is recorded in the identification file. The server can obtain a target identification file corresponding to the client identification from the database, wherein the target identification file comprises a to-be-processed request identification corresponding to a service call request of the client uploading server corresponding to the client identification.
The server can respond to a file acquisition request uploaded by the terminal, and return a target identification file corresponding to the client identification to the terminal, so that after the terminal receives the target identification file, the terminal controls the service calling request according to the target identification file, and determines to continue waiting for a service request response corresponding to the service calling request or stop waiting for the corresponding service request response. Specifically, after receiving a target identification file returned by the server in response to the file acquisition request, the terminal acquires a corresponding service request identification generated according to the service call request and recorded when uploading the service call request to the server, and determines the waiting stop time corresponding to the service call request. The waiting stop time may be determined according to the time when the corresponding service invocation request is sent and the waiting duration corresponding to the service invocation request. And the terminal associates the service request identifier corresponding to the uploaded service calling request with the waiting stop time. The terminal can store the service request identifier, the waiting stop time and the association relationship in the memory, so that the terminal can stop waiting for the corresponding service request response according to the waiting stop time corresponding to the service request identifier.
the terminal can adjust the stop time of the landing corresponding to the service calling request according to the to-be-processed request identifier in the target identifier file. And the terminal compares the request identifier to be processed with the service request identifier and judges whether a service request identifier consistent with the request identifier to be processed in the target identifier file exists in the plurality of service request identifiers. And when the service request identification has consistent to-be-processed request identification, determining that the comparison is successful, and adjusting the waiting stop time corresponding to the service request identification. And when the service request identifier does not have a consistent request identifier to be processed, determining that the comparison fails, and not adjusting the waiting stop time corresponding to the service request identifier.
The terminal can acquire the file acquisition time when the server issues the target identification file, and adjust the waiting stop time corresponding to the successful service request identification according to the comparison of the file acquisition time. And the terminal calculates corresponding target stop time according to the file acquisition time and the waiting duration, and replaces the waiting stop time corresponding to the service request identifier with the target stop time to obtain the adjusted waiting stop time.
after traversing the adjusted waiting stop time corresponding to the service request identifier, the terminal may determine the service request identifier corresponding to the adjusted waiting stop time as the target request identifier. When the existing service request identification is marked as the target request identification, the terminal stops waiting for the service request response corresponding to the target request identification, and releases the communication resources occupied when waiting for the server response, thereby avoiding the waste of the communication resources of the terminal.
In this embodiment, the server, by responding to the file acquisition request uploaded by the terminal, acquires a target identification file corresponding to the client identifier carried in the file acquisition request from the database, and sends the target identification file to the terminal. The target identification file comprises a to-be-processed request identification corresponding to the service calling request in the server, so that the terminal adjusts corresponding waiting stop time according to the to-be-processed request identification and waits for a service request response according to the adjusted waiting stop time. And after the adjusted waiting stop time is reached, the waiting for the corresponding service request response is stopped in time, so that the waste of communication resources is avoided, and the communication resources are effectively saved.
in one embodiment, the service request control method further includes: receiving a service calling request uploaded by a terminal, wherein the service calling request carries a client identifier and a service request identifier corresponding to the service calling request; and updating the target identification file corresponding to the client identification according to the service request identification.
The terminal can generate a service calling request according to the requirement of the client. The terminal can generate a service calling request when the control corresponding to the client is triggered. For example, a user may trigger a control corresponding to the client through the terminal, so that the terminal invokes a service on the server. The terminal can also automatically generate a service calling request according to the actual requirement in the running process of the client. For example, when the client needs to verify the user identity in the operation process, the terminal automatically generates a service invocation request under the condition that the user does not sense, so that the server verifies the user identity.
The terminal may generate a corresponding service request identifier according to the service invocation request. The service request identification may be one of a variety of identifications used to tag service invocation requests. For example, the service request Identifier may be a UUID (Universally Unique Identifier) corresponding to the service invocation request, including a time-based UUID, a name-based UUID, a randomly generated UUID, and the like. The terminal can generate the service request identifier corresponding to the service invoking request in various ways. For example, the terminal may use SHA1(Secure Hash Algorithm) to generate a service request identifier corresponding to the request. The terminal may also generate the service request identifier according to data such as a current timestamp, a random number, and a Media Access Control (MAC) address of the terminal. The terminal can also generate a service request identifier corresponding to the service call request according to a preset mapping relation.
And the terminal sends the service calling request to the server so as to call the corresponding service from the server. The service call request generated by the terminal carries the corresponding service request identifier and the client identifier. The server can receive the service calling request uploaded by the terminal and analyze the service calling request to obtain the client identifier and the service request identifier carried by the service calling request.
the server can mark the service request identifier carried in the service calling request as a to-be-processed request identifier, and update a target identifier file corresponding to the client identifier according to the to-be-processed request identifier. The server may record the service request identifier, i.e., the pending request identifier, in a target identifier file corresponding to the client identifier. Each client identifier in the server has a corresponding target identifier file, and the target identifier file may be stored in a database corresponding to the server. The server may replace the corresponding history identification file in the database with the updated target identification file each time the target identification file is updated, and store the updated target identification file in the database.
In an embodiment, the step of updating the target identity file corresponding to the client identity according to the service request identity includes: marking the service request identifier as a request identifier to be processed, and recording the service request identifier in a target identifier file corresponding to the client identifier; executing a service calling request corresponding to the request identifier to be processed; and after a service request response corresponding to the request identifier to be processed is returned to the terminal, deleting the request identifier to be processed from the target identifier file.
The server can extract a target identification file corresponding to the client identification from the database according to the client identification carried in the service calling request. Since the server needs to respond to the service invocation request uploaded by the terminal, the server may mark the service request identifier corresponding to the service invocation request as a pending request identifier for marking the service invocation request being processed or being prepared to be processed by the server. The server may record the to-be-processed request identifier in a target identifier file corresponding to the client identifier, and store the updated target identifier file in place of the target identifier file before updating.
the server may execute the service invocation request uploaded by the terminal. Specifically, the server may sequentially execute the service invocation requests corresponding to the to-be-processed request identifiers according to the order of the to-be-processed request identifiers recorded in the target identifier file. And after the server returns a service request response corresponding to the request identifier to be processed to the terminal, determining that the service call request corresponding to the request identifier to be processed successfully calls the corresponding service, and finishing the execution of the service call request. The server may delete the pending request identifier corresponding to the executed service invocation request from the target identifier file.
In this embodiment, by carrying the service request identifier and the client identifier in the service invocation request, the server records the service request identifier in a target identifier file corresponding to the client identifier, and deletes the service request identifier from the target identifier file after responding to the service invocation request. The target identification file records the service request identification corresponding to the service call request which is being processed or is ready to be processed by the server, so that the processing condition of the service call request in the server can be clearly and accurately determined, and the waiting stop time corresponding to the service request identification can be accurately adjusted according to the target identification file.
It should be understood that although the various steps in the flow charts of fig. 2-4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-4 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
in one embodiment, as shown in fig. 5, there is provided a service request control apparatus including: a file pull module 502, a time acquisition module 504, a time adjustment module 506, an identification determination module 508, and a wait-to-stop module 510, wherein:
a file pulling module 502, configured to pull the target identification file from the server.
The time obtaining module 504 is configured to obtain waiting stop times corresponding to the multiple service request identifiers.
And a time adjusting module 506, configured to adjust the waiting stop time according to the target identifier file.
An identifier determining module 508, configured to determine a service request identifier corresponding to the adjusted wait stop time, as a target request identifier.
A wait stopping module 510 for stopping waiting for the service request response corresponding to the target request identifier.
In an embodiment, the file pulling module 502 is further configured to send a file acquisition request to the server according to a preset frequency, where the file acquisition request carries the client identifier; and receiving a target identification file corresponding to the client identification returned by the server according to the file acquisition request, wherein the target identification file comprises a to-be-processed request identification corresponding to the service calling request in the server.
in one embodiment, the file pulling module 502 is further configured to encapsulate the file obtaining request in a detection data packet generated according to the connection detection instruction; sending a detection data packet to a server, and receiving a response data packet returned by the server; and analyzing the response data packet to obtain a target identification file.
In one embodiment, the service request control apparatus further includes a request sending module, where the request sending module is configured to generate a service request identifier corresponding to the service invocation request according to the service invocation request; and sending the service call request carrying the service request identifier and the client identifier to a server, so that the server updates a target identifier file corresponding to the client identifier according to the service request identifier.
in one embodiment, the service request control apparatus further includes an identifier association module, configured to obtain a sending time corresponding to the service invocation request and a request waiting duration; determining waiting stop time according to the sending time and the request waiting duration; and associating and storing the service request identifier corresponding to the service calling request with the waiting stop time.
In one embodiment, the identifier association module is further configured to obtain a waiting number corresponding to the service invocation request; calculating pull interval duration corresponding to the target identification file according to a preset frequency; and determining the request waiting time corresponding to the service calling request according to the waiting times and the pulling interval time.
In one embodiment, the time adjustment module 506 is further configured to read a pending request identifier in the target identifier file; acquiring file pulling time corresponding to a target identification file; determining target stop time corresponding to the request identifier to be processed according to the file pulling time and the request waiting time; comparing the request identifier to be processed with the service request identifier; and replacing the waiting stop time corresponding to the service request identifier consistent with the request identifier to be processed with the target stop time.
In one embodiment, as shown in fig. 6, there is provided a service request control apparatus including: a request receiving module 602, a request parsing module 604, a file obtaining module 606, and a request control module 608, wherein:
A request receiving module 602, configured to receive a file obtaining request uploaded by a terminal.
The request parsing module 604 is configured to parse the file obtaining request to obtain a client identifier carried by the file obtaining request.
the file obtaining module 606 is configured to obtain a target identifier file corresponding to the client identifier, where the target identifier file includes a to-be-processed request identifier corresponding to a service invocation request in the server.
The request control module 608 is configured to return the target identifier file to the terminal, so that the terminal adjusts the corresponding waiting stop time according to the to-be-processed request identifier, and waits for a service request response according to the adjusted waiting stop time.
in an embodiment, the service request control apparatus further includes a file update module, configured to receive a service invocation request uploaded by a terminal, where the service invocation request carries a client identifier and a service request identifier corresponding to the service invocation request; and updating the target identification file corresponding to the client identification according to the service request identification.
In one embodiment, the file update module is further configured to mark the service request identifier as a to-be-processed request identifier, and record the service request identifier in a target identifier file corresponding to the client identifier; executing a service calling request corresponding to the request identifier to be processed; and after a service request response corresponding to the request identifier to be processed is returned to the terminal, deleting the request identifier to be processed from the target identifier file.
in one embodiment, there is provided a service request control system including:
The server is used for receiving a file acquisition request uploaded by the terminal; analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request; acquiring a target identification file corresponding to the client identification, wherein the target identification file comprises a to-be-processed request identification corresponding to a service calling request in a server; and returning the target identification file to the terminal.
The terminal is used for pulling the target identification file from the server; obtaining waiting stop time corresponding to a plurality of service request identifications; adjusting the waiting stop time according to the target identification file; determining a service request identifier corresponding to the adjusted waiting stop time as a target request identifier; and stopping waiting for the service request response corresponding to the target request identification.
in one embodiment, the terminal is further configured to send a file acquisition request to the server according to a preset frequency, where the file acquisition request carries a client identifier; and receiving a target identification file corresponding to the client identification returned by the server according to the file acquisition request, wherein the target identification file comprises a to-be-processed request identification corresponding to the service calling request in the server.
In one embodiment, the terminal is further configured to encapsulate the file acquisition request in a detection packet generated according to the connection detection instruction; sending a detection data packet to a server, and receiving a response data packet returned by the server; and analyzing the response data packet to obtain a target identification file.
in one embodiment, the terminal is further configured to generate a service request identifier corresponding to the service invocation request according to the service invocation request; and sending the service call request carrying the service request identifier and the client identifier to a server, so that the server updates a target identifier file corresponding to the client identifier according to the service request identifier.
In one embodiment, the terminal is further configured to obtain a sending time corresponding to the service invocation request and a request waiting duration; determining waiting stop time according to the sending time and the request waiting duration; and associating and storing the service request identifier corresponding to the service calling request with the waiting stop time.
in one embodiment, the terminal is further configured to obtain a number of waiting times corresponding to the service invocation request; calculating pull interval duration corresponding to the target identification file according to a preset frequency; and determining the request waiting time corresponding to the service calling request according to the waiting times and the pulling interval time.
In one embodiment, the terminal is further configured to read a to-be-processed request identifier in the target identifier file; acquiring file pulling time corresponding to a target identification file; determining target stop time corresponding to the request identifier to be processed according to the file pulling time and the request waiting time; comparing the request identifier to be processed with the service request identifier; and replacing the waiting stop time corresponding to the service request identifier consistent with the request identifier to be processed with the target stop time.
In one embodiment, the server is further configured to receive a service invocation request uploaded by the terminal, where the service invocation request carries a client identifier and a service request identifier corresponding to the service invocation request; and updating the target identification file corresponding to the client identification according to the service request identification.
In one embodiment, the server is further configured to mark the service request identifier as a to-be-processed request identifier, and record the service request identifier in a target identifier file corresponding to the client identifier; executing a service calling request corresponding to the request identifier to be processed; and after a service request response corresponding to the request identifier to be processed is returned to the terminal, deleting the request identifier to be processed from the target identifier file.
For specific limitations of the service request control device, reference may be made to the above limitations of the service request control method, which are not described herein again. The respective modules in the service request control apparatus described above may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
in one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a service request control method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
in one embodiment, a computer device is provided, which includes a memory and a processor, the memory storing a computer program, and the processor implementing the steps of the service request control method embodiment when executing the computer program.
In one embodiment, a computer readable storage medium is provided, having stored thereon a computer program, which when executed by a processor, performs the steps in the above-described service request control method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
the above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (15)
1. a service request control method, the method comprising:
pulling a target identification file from a server;
obtaining waiting stop time corresponding to a plurality of service request identifications;
Adjusting the waiting stop time according to the target identification file;
Determining a service request identifier corresponding to the adjusted waiting stop time as a target request identifier;
And stopping waiting for the service request response corresponding to the target request identification.
2. The method of claim 1, wherein pulling the target identification file from the server comprises:
Sending a file acquisition request to the server according to a preset frequency, wherein the file acquisition request carries a client identifier;
and receiving a target identification file corresponding to the client identification returned by the server according to the file acquisition request, wherein the target identification file comprises a to-be-processed request identification corresponding to the service calling request in the server.
3. the method of claim 2, wherein sending the file acquisition request to the server at the preset frequency comprises:
Packaging the file acquisition request in a detection data packet generated according to a connection detection instruction;
Sending the detection data packet to the server, and receiving a response data packet returned by the server;
And analyzing the response data packet to obtain the target identification file.
4. the method of claim 1, further comprising:
Generating a service request identifier corresponding to the service calling request according to the service calling request;
And sending the service call request carrying the service request identifier and the client identifier to the server, so that the server updates a target identifier file corresponding to the client identifier according to the service request identifier.
5. The method of claim 1, wherein prior to obtaining the wait stop time for the plurality of service request identifiers, the method further comprises:
acquiring the sending time corresponding to the service calling request and the request waiting time;
Determining the waiting stop time according to the sending time and the request waiting time;
And associating and storing the service request identifier corresponding to the service calling request with the waiting stop time.
6. The method of claim 5, wherein the obtaining of the sending time and the request waiting duration corresponding to the service invocation request comprises:
Acquiring the waiting times corresponding to the service calling request;
calculating the pulling interval duration corresponding to the target identification file according to the preset frequency;
and determining the request waiting time corresponding to the service calling request according to the waiting times and the pulling interval time.
7. The method of claim 1, wherein said adjusting the wait time from the target identity file comprises:
Reading a request identifier to be processed in the target identifier file;
acquiring file pulling time corresponding to the target identification file;
Determining target stop time corresponding to the request identifier to be processed according to the file pulling time and the request waiting time;
Comparing the request identifier to be processed with the service request identifier;
And replacing the waiting stop time corresponding to the service request identifier consistent with the request identifier to be processed with the target stop time.
8. a service request control method, the method comprising:
Receiving a file acquisition request uploaded by a terminal;
Analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request;
acquiring a target identification file corresponding to the client identification, wherein the target identification file comprises a to-be-processed request identification corresponding to a service calling request in a server;
And returning the target identification file to the terminal, so that the terminal adjusts the corresponding waiting stop time according to the request identification to be processed, and waits for a service request response according to the adjusted waiting stop time.
9. The method of claim 8, further comprising:
Receiving the service calling request uploaded by the terminal, wherein the service calling request carries the client identifier and a service request identifier corresponding to the service calling request;
and updating the target identification file corresponding to the client identification according to the service request identification.
10. the method of claim 9, wherein the step of updating the target identity file corresponding to the client identity according to the service request identity comprises:
Marking the service request identifier as the request identifier to be processed, and recording the service request identifier in a target identifier file corresponding to the client identifier;
Executing a service calling request corresponding to the request identifier to be processed;
And after a service request response corresponding to the request identifier to be processed is returned to the terminal, deleting the request identifier to be processed from the target identifier file.
11. A service request control apparatus, characterized in that the apparatus comprises:
the file pulling module is used for pulling the target identification file from the server;
The time acquisition module is used for acquiring waiting stop time corresponding to the service request identifications;
The time adjusting module is used for adjusting the waiting stop time according to the target identification file;
The identification determining module is used for determining a service request identification corresponding to the adjusted waiting stop time as a target request identification;
And the waiting stopping module is used for stopping waiting for the service request response corresponding to the target request identifier.
12. a service request control apparatus, characterized in that the apparatus comprises:
The request receiving module is used for receiving a file acquisition request uploaded by the terminal;
The request analysis module is used for analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request;
the file acquisition module is used for acquiring a target identification file corresponding to the client identification, wherein the target identification file comprises a to-be-processed request identification corresponding to a service calling request in a server;
And the request control module is used for returning the target identification file to the terminal, so that the terminal adjusts the corresponding waiting stop time according to the to-be-processed request identification and waits for a service request response according to the adjusted waiting stop time.
13. a service request control system, the system comprising:
the server is used for receiving a file acquisition request uploaded by the terminal; analyzing the file acquisition request to obtain a client identifier carried by the file acquisition request; acquiring a target identification file corresponding to the client identification, wherein the target identification file comprises a to-be-processed request identification corresponding to a service calling request in a server; returning the target identification file to the terminal;
The terminal is used for pulling the target identification file from the server; obtaining waiting stop time corresponding to a plurality of service request identifications; adjusting the waiting stop time according to the target identification file; determining a service request identifier corresponding to the adjusted waiting stop time as a target request identifier; and stopping waiting for the service request response corresponding to the target request identification.
14. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 10 when executing the computer program.
15. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910864333.1A CN110557398B (en) | 2019-09-12 | 2019-09-12 | Service request control method, device, system, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910864333.1A CN110557398B (en) | 2019-09-12 | 2019-09-12 | Service request control method, device, system, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110557398A true CN110557398A (en) | 2019-12-10 |
CN110557398B CN110557398B (en) | 2022-05-17 |
Family
ID=68740139
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910864333.1A Active CN110557398B (en) | 2019-09-12 | 2019-09-12 | Service request control method, device, system, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110557398B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111182065A (en) * | 2019-12-30 | 2020-05-19 | 深圳奇迹智慧网络有限公司 | Message processing method and device based on MQTT protocol and computer equipment |
CN112231114A (en) * | 2020-09-22 | 2021-01-15 | 深圳云天励飞技术股份有限公司 | Event processing method and related equipment |
CN113448708A (en) * | 2021-06-30 | 2021-09-28 | 平安养老保险股份有限公司 | Asynchronous waiting duration optimization method and device, computer equipment and storage medium |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1474548A (en) * | 2002-08-19 | 2004-02-11 | 乐金电子(天津)电器有限公司 | Changing method of waiting time |
CN1533098A (en) * | 2003-03-25 | 2004-09-29 | 乐金电子(天津)电器有限公司 | Method for realizing adjust-able waiting time |
CN102291723A (en) * | 2006-01-11 | 2011-12-21 | 高通股份有限公司 | Wireless communication methods and apparatus using beacon signals |
CN102572875A (en) * | 2010-11-22 | 2012-07-11 | 微软公司 | Network latency estimation for mobile devices |
CN102957946A (en) * | 2011-08-23 | 2013-03-06 | 美国博通公司 | Dynamic bandwidth re-allocation |
EP2731307A2 (en) * | 2011-07-07 | 2014-05-14 | Samsung Electronics Co., Ltd. | Apparatus and method for controlling device triggering in a mobile communication network |
WO2014127158A1 (en) * | 2013-02-14 | 2014-08-21 | Tibco Software Inc. | Application congestion control |
CN104412670A (en) * | 2012-06-25 | 2015-03-11 | 高通股份有限公司 | System and method for reducing power consumption in a wireless communication system |
CN105635083A (en) * | 2014-11-14 | 2016-06-01 | 航天信息股份有限公司 | Service processing method and service processing system based on server and client architecture |
CN108366091A (en) * | 2018-01-10 | 2018-08-03 | 深圳市金立通信设备有限公司 | Network request processing method, terminal and computer-readable medium |
CN109086124A (en) * | 2017-06-13 | 2018-12-25 | 龙芯中科技术有限公司 | Method, apparatus, electronic equipment and the storage medium of adjustment time |
CN112954013A (en) * | 2021-01-27 | 2021-06-11 | 政采云有限公司 | Network file information acquisition method, device, equipment and storage medium |
-
2019
- 2019-09-12 CN CN201910864333.1A patent/CN110557398B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1474548A (en) * | 2002-08-19 | 2004-02-11 | 乐金电子(天津)电器有限公司 | Changing method of waiting time |
CN1533098A (en) * | 2003-03-25 | 2004-09-29 | 乐金电子(天津)电器有限公司 | Method for realizing adjust-able waiting time |
CN102291723A (en) * | 2006-01-11 | 2011-12-21 | 高通股份有限公司 | Wireless communication methods and apparatus using beacon signals |
CN102572875A (en) * | 2010-11-22 | 2012-07-11 | 微软公司 | Network latency estimation for mobile devices |
EP2731307A2 (en) * | 2011-07-07 | 2014-05-14 | Samsung Electronics Co., Ltd. | Apparatus and method for controlling device triggering in a mobile communication network |
CN102957946A (en) * | 2011-08-23 | 2013-03-06 | 美国博通公司 | Dynamic bandwidth re-allocation |
CN104412670A (en) * | 2012-06-25 | 2015-03-11 | 高通股份有限公司 | System and method for reducing power consumption in a wireless communication system |
WO2014127158A1 (en) * | 2013-02-14 | 2014-08-21 | Tibco Software Inc. | Application congestion control |
CN105635083A (en) * | 2014-11-14 | 2016-06-01 | 航天信息股份有限公司 | Service processing method and service processing system based on server and client architecture |
CN109086124A (en) * | 2017-06-13 | 2018-12-25 | 龙芯中科技术有限公司 | Method, apparatus, electronic equipment and the storage medium of adjustment time |
CN108366091A (en) * | 2018-01-10 | 2018-08-03 | 深圳市金立通信设备有限公司 | Network request processing method, terminal and computer-readable medium |
CN112954013A (en) * | 2021-01-27 | 2021-06-11 | 政采云有限公司 | Network file information acquisition method, device, equipment and storage medium |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111182065A (en) * | 2019-12-30 | 2020-05-19 | 深圳奇迹智慧网络有限公司 | Message processing method and device based on MQTT protocol and computer equipment |
CN112231114A (en) * | 2020-09-22 | 2021-01-15 | 深圳云天励飞技术股份有限公司 | Event processing method and related equipment |
CN113448708A (en) * | 2021-06-30 | 2021-09-28 | 平安养老保险股份有限公司 | Asynchronous waiting duration optimization method and device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110557398B (en) | 2022-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110557398B (en) | Service request control method, device, system, computer equipment and storage medium | |
CN110008118B (en) | Page data testing method and device, computer equipment and storage medium | |
CN108011929B (en) | Data request processing method and device, computer equipment and storage medium | |
CN110719318B (en) | Message processing method and system | |
CN108256114B (en) | Document online preview method and device, computer equipment and storage medium | |
CN108834086B (en) | Method and device for sending short message, computer equipment and storage medium | |
CN108446172B (en) | Data calling method and device, computer equipment and storage medium | |
CN110602169B (en) | Service calling method and device, computer equipment and storage medium | |
CN111143462A (en) | Data export method and device, computer equipment and storage medium | |
CN111159233B (en) | Distributed caching method, system, computer equipment and storage medium | |
CN110267060B (en) | Video file storage injection method and device, computer equipment and storage medium | |
WO2021121407A1 (en) | Capacity changing method and apparatus for virtual machine | |
CN112698789B (en) | Data caching method, device, equipment and storage medium | |
CN108763046B (en) | Thread running monitoring method, device, computer equipment and storage medium | |
CN113810433A (en) | File uploading method and device and computer equipment | |
CN112070585A (en) | Order state unified management method and device, computer equipment and storage medium | |
CN113900774A (en) | Virtual machine control method and device of cloud operating system and storage medium | |
CN111447136B (en) | Message pushing method and device, computer equipment and storage medium | |
CN110049350B (en) | Video transcoding processing method and device, computer equipment and storage medium | |
CN111966530A (en) | Disaster recovery switching method and device for application system, computer equipment and storage medium | |
CN115509861A (en) | Process monitoring method, system, computer device and storage medium | |
CN115733737A (en) | Method for managing IP drift and storage machine frame | |
CN109254997B (en) | Data synchronization method, system, computer device and readable storage medium | |
CN113742681B (en) | Account management method and device, computer equipment and storage medium | |
CN112559248B (en) | Preprocessing service recovery method, device, equipment and storage medium |
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 |