CN111355765B - Network request processing and sending method and device - Google Patents

Network request processing and sending method and device Download PDF

Info

Publication number
CN111355765B
CN111355765B CN201811590793.1A CN201811590793A CN111355765B CN 111355765 B CN111355765 B CN 111355765B CN 201811590793 A CN201811590793 A CN 201811590793A CN 111355765 B CN111355765 B CN 111355765B
Authority
CN
China
Prior art keywords
request
network
identifier
recorded
network request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811590793.1A
Other languages
Chinese (zh)
Other versions
CN111355765A (en
Inventor
邓林文
李文文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201811590793.1A priority Critical patent/CN111355765B/en
Publication of CN111355765A publication Critical patent/CN111355765A/en
Application granted granted Critical
Publication of CN111355765B publication Critical patent/CN111355765B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the invention provides a method and a device for processing and sending a network request, wherein the method for processing the network request comprises the following steps: receiving a network request sent by a terminal, wherein the network request carries a request identifier; judging whether the request identifier is matched with the recorded request identifier to obtain a matching result, wherein the recorded request identifier is as follows: before receiving the network request, the server receives a request identifier carried by other network requests; and responding to the network request according to the matching result. Therefore, the electronic device can recognize repeated network requests according to the matching condition of the request identifier of the network request and the recorded request identifier, and can respond to the network request in a proper processing mode according to the matching result, so that the condition that the same network request obtains different response results is avoided, and the problem that the response result of the network request is disordered is avoided.

Description

Network request processing and sending method and device
Technical Field
The present invention relates to the field of network technologies, and in particular, to a method and an apparatus for processing and sending a network request.
Background
With the popularization of networks, the networks become an indispensable part of people in work and life. The network can implement various functions, for example, people can access various websites through the network to obtain required information; network storage and query operation of data can be realized through cloud storage and the like; the function of the virtual server may also be implemented by a virtual machine or the like.
In order for a user to be able to use various functions implemented over a network, the user terminal needs to cooperate with a corresponding server in the network. When a terminal accesses a server, the terminal often sends a network request to the server, where the network request is a request for requesting a service from the server, and for example, the network request may include various requests such as a login request and a video request. After receiving the network request, the server calls a network interface to respond to the network request so as to realize the service requested by the terminal.
After the server is restarted or the network condition is unstable, the server may receive a repeated network request sent by the terminal, and since the server cannot recognize the repeated network request, the repeated network request may be repeatedly responded, for example, different network interfaces are called to respond, so that the same network request may obtain different response results, and the response result of the network request may be confused.
Disclosure of Invention
Embodiments of the present invention provide a method and an apparatus for processing and sending a network request, so as to avoid a situation that the same network request obtains different response results, and avoid a confusion of response results of the network request. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for processing a network request, where the method is applied to a server, and the method includes:
receiving a network request sent by a terminal, wherein the network request carries a request identifier of the network request;
judging whether the request identifier is matched with the recorded request identifier to obtain a matching result, wherein the recorded request identifier is as follows: the request identifier carried by other network requests received by the server before the network request is received;
and responding to the network request according to the matching result.
Optionally, the step of responding to the network request according to the matching result includes:
if the request identification is matched with the recorded request identification, calling a specific network interface to respond to the network request, wherein the specific network interface is as follows: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier in the recorded request identifiers.
Optionally, the recorded request identifier corresponds to a receiving time point of the network request;
the step of judging whether the request identifier is matched with the recorded request identifier includes:
acquiring a receiving time point of the network request;
determining a time period to be matched according to the receiving time point of the network request;
and judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
Optionally, the method further includes:
and recording the request identification if the request identification does not match the recorded request identification.
Optionally, the method further includes:
and deleting the request identifications which are not matched successfully in a second preset time period from the recorded request identifications of the network request.
And/or
And deleting all recorded request identifications at the end of the current period according to a preset period.
Optionally, the step of determining whether the request identifier matches the recorded request identifier includes:
if the network request is received within a preset time after the server is restarted, judging whether the request identifier is matched with the recorded request identifier;
or the like, or, alternatively,
and if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
Optionally, the method further includes:
and sending a response result of the network request to the terminal, wherein the response result carries the request identifier and the response time of the network request.
In a second aspect, an embodiment of the present invention further provides a method for sending a network request, where the method is applied to a terminal, and the method includes:
acquiring an operation instruction of a user;
generating a network request corresponding to the operation instruction according to the operation instruction;
adding request identifications to the network request, wherein the network request corresponds to the request identifications one to one;
sending a network request added with a request identifier to a server so that the server judges whether the request identifier is matched with the request identifier recorded by the server or not, and responding to the network request according to the matching result;
wherein the recorded request identification is: and the request identifier carried by other network requests received by the server before the network request is received.
Optionally, the method further includes:
receiving a response result sent by the server, wherein the response result carries a request identifier and response time of the network request;
and recording response information of the network request based on the request identification and the response time of the network request.
In a third aspect, an embodiment of the present invention provides an apparatus for processing a network request, where the apparatus is applied to a server, and the apparatus includes:
the request receiving module is used for receiving a network request sent by a terminal, wherein the network request carries a request identifier;
an identifier matching module, configured to determine whether the request identifier matches a recorded request identifier, to obtain a matching result, where the recorded request identifier is: the request identifier carried by other network requests received by the server before the network request is received;
and the request response module is used for responding to the network request according to the matching result.
Optionally, the request response module includes:
a first response unit, configured to invoke a specific network interface to respond to the network request if the request identifier matches a recorded request identifier, where the specific network interface is: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier in the recorded request identifiers.
Optionally, the recorded request identifier corresponds to a receiving time point of the network request;
the identification matching module comprises:
a time point obtaining unit, configured to obtain a receiving time point of the network request;
a time period determining unit, configured to determine a time period to be matched according to a receiving time point of the network request;
and the identifier matching unit is used for judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
Optionally, the apparatus further comprises:
and the identification recording module is used for recording the request identification if the request identification is not matched with the recorded request identification.
Optionally, the apparatus further comprises:
the deleting module is used for deleting the request identifier which is not successfully matched in a second preset time period in the recorded request identifiers of the network request; and/or deleting all recorded request identifications at the end of the current period according to a preset period.
Optionally, the identifier matching module includes:
the identification matching unit is used for judging whether the request identification is matched with the recorded request identification or not if the network request is received within the preset time after the server is restarted; or, if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
Optionally, the apparatus further comprises:
and the response result sending module is used for sending a response result of the network request to the terminal, wherein the response result carries the request identifier and the response time of the network request.
In a fourth aspect, an embodiment of the present invention further provides a device for sending a network request, where the device is applied to a terminal, and the device includes:
the instruction acquisition module is used for acquiring an operation instruction of a user;
the request generation module is used for generating a network request corresponding to the operation instruction according to the operation instruction;
an identifier adding module, configured to add a request identifier to the network request, where the network request corresponds to the request identifier one to one;
the request sending module is used for sending the network request added with the request identifier to a server so as to enable the server to judge whether the request identifier is matched with the request identifier recorded by the server or not, and responding to the network request according to the matching result;
wherein the recorded request identification is: and the request identifier carried by other network requests received by the server before the network request is received.
Optionally, the apparatus further comprises:
a response result receiving module, configured to receive a response result sent by the server, where the response result carries a request identifier and response time of the network request;
and the response information recording module is used for recording the response information of the network request based on the request identification and the response time of the network request.
On the other hand, the embodiment of the invention also provides a server, which comprises a processor, a memory and a communication bus, wherein the processor and the memory complete the communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of the processing method of any network request when the program stored in the memory is executed.
On the other hand, the embodiment of the invention also provides a terminal, which comprises a processor, a memory and a communication bus, wherein the processor and the memory finish mutual communication through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of the network request sending method when executing the program stored in the memory.
On the other hand, the embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method for processing any network request.
On the other hand, the embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of sending the network request.
In the scheme provided by the embodiment of the invention, the server can firstly receive the network request sent by the terminal, then judge whether the request identifier carried in the network request is matched with the recorded request identifier to obtain a matching result, and then respond to the network request according to the matching result. Since the recorded request identification is: the electronic equipment can identify repeated network requests according to the matching condition of the request identifier of the network request and the recorded request identifier, and then can respond to the network requests in a proper processing mode according to the matching result, so that the condition that the same network requests obtain different response results is avoided, and the problem that the response results of the network requests are disordered is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for processing a network request according to an embodiment of the present invention;
FIG. 2 is a flowchart of one manner in which embodiments of the present invention may determine whether a request tag matches a recorded request tag;
fig. 3 is a flowchart of a method for sending a network request according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a network request processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a network request sending apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a server according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to avoid the situation that the same network request obtains different response results and avoid the problem of confusion of the response results of the network request, embodiments of the present invention provide a network request processing method, a network request sending device, a server, a terminal, and a computer-readable storage medium.
First, a method for processing a network request according to an embodiment of the present invention is described below.
The method for processing the network request provided by the embodiment of the invention can be applied to any server which needs to respond to the network request.
As shown in fig. 1, a method for processing a network request is applied to a server, and the method includes:
s101, receiving a network request sent by a terminal;
wherein, the network request carries the request identification of the network request;
s102, judging whether the request identification is matched with the recorded request identification to obtain a matching result;
wherein the recorded request identification is: the request identifier carried by other network requests received by the server before the network request is received;
s103, responding to the network request according to the matching result.
Therefore, in the scheme provided by the embodiment of the invention, the server can firstly receive the network request sent by the terminal, then judge whether the request identifier carried in the network request is matched with the recorded request identifier to obtain the matching result, and then respond to the network request according to the matching result. Since the recorded request identification is: the electronic equipment can identify repeated network requests according to the matching condition of the request identifier of the network request and the recorded request identifier, and then can respond to the network requests in a proper processing mode according to the matching result, so that the condition that the same network requests obtain different response results is avoided, and the problem that the response results of the network requests are disordered is avoided.
When the user needs a certain network service, the network request is sent to the server through the terminal, so that in step S101, the server can also receive the network request sent by the terminal. Wherein, the network request carries the request identifier. The request identifier is used to identify the network request, and may adopt any manner that can play a role of identification, such as a manner of letters, numbers, or a combination of the two, or may adopt a magic number as the request identifier.
In order to determine whether the currently received network request and the previously received network request are repeated network requests, all network requests received by the server may carry a request identifier. In this way, in step S102, the server may determine whether the request identifier carried by the received network request matches the recorded request identifier, so as to obtain a matching result. In one implementation, the server may traverse all recorded request identifiers to determine whether the request identifier carried by the received network request matches the recorded request identifier.
Wherein, the recorded request identifier may be: the request identifier carried by other network requests received by the server before receiving the network request sent by the terminal, that is, the request identifier carried by these network requests recorded by the server when receiving the network request sent by the terminal before the network request.
Furthermore, after the server obtains the matching result, that is, it is determined that the request identifier carried by the currently received network request matches the recorded request identifier, or after the matching result is not matched, the server can respond to the network request according to the matching result, so that the repeated network requests obtain the same response result, and the problem of network request response result confusion is avoided.
In an embodiment, different network interfaces may correspond to different network request processing functions, and different response results may be obtained, so that the server may respond to the network request according to the matching result and a preset network interface call rule.
In another embodiment, the electronic device may process the network request according to the matching result and the processing condition of the network request. If the matching result is that the request identifier carried by the network request does not match the recorded request identifier, which indicates that the network request is different from the network request received by the server before, the server may respond to the network request.
If the matching result is that the request identifier carried by the network request matches the recorded request identifier, which indicates that the network request is a duplicate of the network request previously received by the server, the server may determine the processing status of the previously received network request, and if the processing status of the previously received network request is in-process or completed-process, the electronic device may not respond to the currently received network request in order to avoid confusion. The server may respond to the network request if the processing status of the previously received network request is stop processing.
For example, the server currently receives a backup data network request B, and a request identifier B carried by the backup data network request B matches with a recorded request identifier B, the server may determine a processing state of the network request corresponding to the request identifier B, and if the processing state of the network request corresponding to the request identifier B is in process, the server may not respond to the backup data network request B, so as to avoid confusion of a point in time of backup data due to repeated data backup operations.
As an implementation manner of the embodiment of the present invention, the step of responding to the network request according to the matching result may include:
if the request identification is matched with the recorded request identification, calling a specific network interface to respond to the network request; and if the request identification is not matched with the recorded request identification, calling a non-specific network interface to respond to the network request.
If the matching result is that the request identifier carried by the currently received network request is matched with the recorded request identifier, it indicates that the network request is repeated with a certain network request in the network requests received by the server before, and in order to ensure that the same response result is obtained and the accuracy of the response result of the network request is ensured, the server may invoke a specific network interface to respond to the network request, where the specific network interface may be: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier carried by the currently received network request in the recorded request identifiers.
For example, the request identifier a carried by the currently received network request a, and the recorded request identifiers a, b, c, d, and e correspond to the network request A, B, C, D, E, respectively. The server judges that the request identifier a carried by the currently received network request is the same as the recorded request identifier a, namely the request identifier a is matched with the recorded request identifier a, and the network request a are repeated network requests. If the network interface responding to the network request a is a1, the server may call the network interface a1 to respond to the network request a at the time that the network interface a1 is the specific network interface.
If the matching result is that the request identifier carried by the currently received network request is not matched with the recorded request identifier, it indicates that the currently received network request is different from the previously received network request of the server, that is, the currently received network request is a new network request. Then the server may invoke the non-specific network interface to respond to the currently received network request. Wherein, the non-specific network interface is: a network interface different from a network interface responding to a network request prior to a currently received network request.
For example, the request identifier carried by the currently received network request M is M, the recorded request identifiers a, B, C, D, and E correspond to the network request A, B, C, D, E, respectively, and the network interfaces for responding to the network request A, B, C, D, E are network interfaces a0, B0, C0, D0, and E0, respectively. The server determines that the request identifier M is different from the recorded request identifiers a, b, c, d, and e, which indicates that the network request M is not repeated with the network request A, B, C, D, E. Then the server may invoke a non-specific network interface to respond to the network request M, i.e., a network interface different from the network interfaces a0, B0, C0, D0, E0.
As can be seen, in this embodiment, if the request identifier carried by the currently received network request matches the recorded request identifier, the server may invoke a specific network interface to respond to the network request; if the request identifier carried by the currently received network request is not matched with the recorded request identifier, the server can invoke a non-specific network interface to respond to the network request, so that the same response result can be obtained by repeated network requests, and the disorder of the response result of the network request is avoided.
Since the receiving of the repeated network request may be within a period of time, for example, a period of time after the server is restarted, a period of time when the network condition is unstable, and the like, in order to increase the speed of obtaining the matching result, as an implementation manner of the embodiment of the present invention, the recorded request identifier may correspond to a receiving time point of the network request.
The server may record the point in time of receipt of the received network request when receiving the network request, it being understood that the server may record the point in time of receipt of the network request received before the currently received network request and may also record the point in time of receipt of the currently received network request for determining a matching result when subsequently receiving the network request.
The receiving time point is the time point when the server receives the network request. The receiving time point recorded by the server may be represented by a timestamp, etc., as long as the receiving time point of the network request by the server can be represented, and is not particularly limited herein. The precision of the receiving time point recorded by the server may be determined according to actual needs, for example, the precision may be as accurate as minutes, seconds, milliseconds, and the like, and is not limited in this respect.
In this way, the recorded request identification corresponds to the reception time point of the network request. In order to facilitate searching for the request identifier, the network interface, and the receiving time point corresponding to the network request recorded by the server, the server may construct a table for recording the request identifier, the network interface, and the receiving time point corresponding to the network request, for example, as shown in the following table:
network request Request identification Network interface Receiving time point
Q1 S1 A1 201805150910
Q2 S2 A2 201805150915
Q3 S3 A3 201805151051
Qn Sn An 201805151526
Accordingly, as shown in fig. 2, the step of determining whether the request identifier matches the recorded request identifier may include:
s201, acquiring a receiving time point of the network request;
first, the server may acquire a reception time point of a currently received network request. Since the request identifier corresponds to a receiving time point of the network request, in an embodiment, the server may obtain the receiving time point of the currently received network request according to the request identifier carried by the currently received network request.
For example, the server stores the table, and if the request identifier carried by the currently received network request is Qn, the server may query the table, determine that the receiving time point corresponding to the request identifier Qn is 201805151526, and then the receiving time point of the currently received network request is 201805151526.
S202, determining a time period to be matched according to the receiving time point of the network request;
since the repeated network requests received by the server may be within a period of time, the server may determine the period of time as a first preset period of time, and may further determine, according to the recorded receiving time point, a period of time within the first preset period of time from the current time point as a period of time to be matched. If the network request is received within the time period to be matched, it indicates that the network request is received within the first preset time period, and the network request may be a repeated network request.
For example, the server is restarted at 9 o ' clock 5/15/2015, and the network request W is received at 9 o ' clock 5/15/2015, so that the server can use a period of time from the restart of the server to the reception of the network request W as the period of time to be matched, that is, 9 o ' clock 5/15/2015, which is to be used as the period of time to be matched.
S203, judging whether the request identification of the network request is matched with the recorded request identification corresponding to the receiving time point in the time period to be matched.
After the time period to be matched is determined, the server can judge whether the request identifier of the currently received network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched. Still taking the example in step S202 as an example, assuming that the network identifier of the network request W is S0, and the server determines that the time period to be matched is from 9 point 9 at 15 th day 9 in 2015 to 30 point 9 at 15 th day 9 in 2015, the server may determine whether the request identifier S0 matches the request identifier corresponding to the recorded receiving time point from 9 point 9 at 15 th day 9 in 2015 to 30 point 9 at 15 th day 9 in 2015, and then obtain the matching result.
Therefore, in this embodiment, the server may record the receiving time point of the received network request, determine the time period to be matched according to the recorded receiving time point, and further determine whether the request identifier carried by the currently received network request matches the recorded request identifier corresponding to the receiving time point located in the time period to be matched, so as to obtain a matching result, thereby reducing the number of network identifiers to be matched and improving the matching efficiency.
As an implementation manner of the embodiment of the present invention, the method may further include: and recording the request identification if the request identification does not match the recorded request identification.
In order to facilitate determining the condition of the network request received after the currently received network request, if the request identifier carried by the currently received network request does not match the recorded request identifier, the server may further record the request identifier of the currently received network request, so that when the network request sent by the terminal is received after the currently received network request, the recorded network request identifier includes the request identifier carried by the currently received network request. If the request identifier of the network request after the currently received network request is matched with the request identifier carried by the currently received network request, the server can identify the request identifier, and then a network interface for responding to the currently received network request is called to respond to the network request, so that the network request response result is prevented from being confused.
Since the larger the number of request identifiers recorded by the server is, the longer the time required for searching the request identifiers is, which may cause the speed of determining the matching result by the server to become slower, as an implementation manner of the embodiment of the present invention, the method may further include:
deleting a part of all recorded request identifications according to a first preset mode; or deleting all recorded request identifications according to a second preset mode.
In a first embodiment, the server may delete a part of all recorded request identifiers according to a first preset manner. In one implementation, the server may delete the first recorded request identifier, i.e., the request identifier of the earliest received network request, after receiving a network request and recording its request identifier. For example, taking the request flag recorded in the table as an example, the server may delete the request flag S1 after receiving the network request Qn +1 after the network request Qn and recording the request flag Sn + 1.
In another implementation, a preset number of recorded request identifiers may be deleted according to a preset time. For example, the server may delete 10 recorded request identifications every 1 hour. The recorded request identifiers of the preset number of deleted requests may be deleted randomly, or deleted from the first recorded request identifier according to the recording order, which is not limited specifically herein.
For example, as an example of the request identifiers recorded in the above table, assuming that the current time is 2015, 5, 16, 8, the server may delete the recorded request identifier Q1-request identifier Q10, Q1, Q2, Q4, Q6, Q7, Q9, Q10, Q14, Q16, and Q21 at 2015, 5, 16, and 9.
In a second embodiment, the server may delete all recorded request identifiers according to a second preset manner. In one implementation, the server may delete all recorded request identifiers at a preset time point. For example, all recorded request identifiers are deleted at 24 points per day, at a time point after the server is restarted for 2 hours, and the like.
As can be seen, in this embodiment, the server may delete a part of all recorded request identifiers according to a first preset manner, or delete all recorded request identifiers according to a second preset manner. The recorded request identification is cleaned, the number of the request identifications recorded by the server is reduced, the time required for searching the request identification is shortened, and the speed of determining the matching result by the server is improved.
As an implementation manner of the embodiment of the present invention, the step of deleting a part of all recorded request identifiers according to the first preset manner may include:
and deleting the request identifications which are not matched successfully in a second preset time period in the recorded request identifications.
Wherein, the second preset time period may be: from the point in time when the network request is received to a period of time of a preset duration after the point in time. Since the repeated network requests sent by the general terminal occur after the network conditions are unstable or the server is restarted, and the network conditions are unstable or the server is generally not restarted for too long, the network requests repeated with the terminal are not received within a period of time after the network requests are received, and then the probability that the server receives the network requests repeated with the terminal is very small.
Therefore, if the request identifier of the other network request received by the server does not match the request identifier of the network request within a period of time after the network request is received, that is, the request identifier of the network request is not successfully matched, the probability that the network request repeated with the network request is received within a period of time after the network request is received is very small, and the server may delete the request identifier of the network request.
For example, it is assumed that the second preset time period is a time period from a time point at which the network request is received to 1 hour after the time point. Then if the server receives the network request 1 at the point in time of 2018, 5, 16, 11 hours, the second predetermined time period is from 2018, 5, 16, 11 hours, 27 hours, to 2018, 5, 16, 12 hours, 27 hours. After receiving the network request 1, the server receives the network request 2-network request 35 in a second preset time period, but the request identifier of the network request 2-network request 35 is not matched with the request identifier of the network request 1, which indicates that no network request which is repeated with the network request 1 exists in the network request 2-network request 35, and then the server may delete the recorded request identifier of the network request 1.
As can be seen, in this embodiment, the server may delete the request identifier that is not successfully matched within the second preset time period from the recorded request identifiers of the network request. The recorded request identification is cleaned, the number of the request identifications recorded by the server is reduced, the time required for searching the request identification is shortened, and the speed of determining the matching result by the server is improved.
As an implementation manner of the embodiment of the present invention, the step of deleting all recorded request identifiers according to the second preset manner may include:
and deleting all recorded request identifications at the end of the current period according to a preset period.
The preset period may be 2 hours, 5 hours, 1 day, etc., and is not limited herein. In order to regularly clean the request identifiers recorded by the server, the server may delete all the recorded request identifiers at the end of the current period.
For example, if the preset period is 1 day, the server may delete all recorded request identifiers at the end of the day, and further record the request identifiers of the received network requests again at the beginning of the next day.
As can be seen, in this embodiment, the server may delete all recorded request identifiers at the end of the current period according to a preset period. The recorded request identification is cleaned, the number of the request identifications recorded by the server is reduced, the time required for searching the request identification is shortened, and the speed of determining the matching result by the server is improved.
As an implementation manner of the embodiment of the present invention, the step of determining whether the request identifier matches the recorded request identifier may include:
if the network request is received within a preset time after the server is restarted, judging whether the request identifier is matched with the recorded request identifier; or, if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
Because the situation that the server receives the repeated network request generally occurs after the server is restarted or when the network condition is abnormal, when the server judges whether the request identifier carried by the currently received network request is matched with the recorded request identifier, the server can firstly determine whether the currently received network request is received after the server is restarted and whether the current network condition is abnormal, if one of the request identifier and the recorded request identifier is satisfied, the probability that the server receives the repeated network request is high at the moment, the server can judge whether the request identifier carried by the currently received network request is matched with the recorded request identifier, so as to determine whether the currently received network request is the repeated network request.
It can be seen that, in the embodiment of the present invention, when determining whether a request identifier carried by a currently received network request matches a recorded request identifier, a server may first determine whether the currently received network request is received after the server is restarted and whether a current network condition is abnormal, and when the currently received network request is received after the server is restarted or when the current network condition is abnormal, then determine whether the request identifier carried by the currently received network request matches the recorded request identifier, so that when a probability that the server receives a repeated network request is high, it may be determined whether the network request carried by the currently received network request is a repeated network request, thereby avoiding resource waste.
As an implementation manner of the embodiment of the present invention, the method may further include:
and sending a response result of the network request to the terminal.
Since information such as a time point at which the network request is responded is important for a network request such as a network request for backup data, the server may transmit a response result of the network request to the terminal after responding to the network request.
The response result may carry information such as a request identifier and response time of the network request. Thus, after receiving the response result, the terminal can determine and record response information such as response time of the responded network request according to the request identifier of the network request carried by the response result.
For example, the server receives data backup network request a1 at point 10 and point 7, data backup network request a1 carries request identifier a1, the server determines that the request identifier is the same as the request identifier carried by data backup network request a0 received at point 10, and further determines that data backup network request a0 is being processed, the server does not respond to network request a1 for data backup, and after the data backup network request a0 completes responding, the server sends a response result of data backup network request a0 to the terminal, and the response result includes request identifier a1 and response time point 10.
Therefore, in this embodiment, after responding to the network request, the server may send a response result of the network request to the terminal to notify the terminal of a response condition of the network request, so as to facilitate recording by the terminal.
Corresponding to the processing method of the network request, the embodiment of the invention also provides a sending method of the network request.
The following describes a method for sending a network request according to an embodiment of the present invention.
The method for sending the network request provided by the embodiment of the invention can be applied to any terminal capable of sending the network request.
As shown in fig. 3, a method for sending a network request is applied to a terminal, and the method includes:
s301, acquiring an operation instruction of a user;
s302, generating a network request corresponding to the operation instruction according to the operation instruction;
s303, adding a request identifier for the network request, wherein the network request corresponds to the request identifier one by one;
s304, sending the network request added with the request identifier to a server so that the server judges whether the request identifier is matched with the request identifier recorded by the server according to the request identifier, and responding to the network request according to the matching result;
wherein the recorded request identification is: and the request identifier carried by other network requests received by the server before the network request is received.
Therefore, in the scheme provided by the embodiment of the invention, the terminal can firstly acquire the operation instruction of the user, generate the network request corresponding to the operation instruction according to the operation instruction, add the request identifier to the network request, and further send the network request added with the request identifier to the server. Because the request identifier can identify the network request, when the terminal sends the repeated network request to the server, the server can identify the repeated network request according to the request identifier, thereby avoiding the situation that the same network request obtains different response results and avoiding the problem that the response result of the network request is disordered.
When a user needs a certain network service, the terminal is operated, for example, a certain button is clicked, a certain website is input, and the terminal can obtain an operation instruction of the user. Further, in step S302, the terminal may generate a network request corresponding to the operation command according to the operation command, and specifically, the terminal may generate a network request corresponding to an operation command of the user according to a network protocol between the terminal and the server. For example, if the user's operation command is "download data K", the terminal may generate a network request for requesting the data K from the server.
Next, in step S303, the terminal may add a request identifier to the generated network request so that the server can recognize the repeated network request when receiving the network request. It is understood that the request identifier of each network request is different, that is, the network requests correspond to the request identifiers one to one. The request identifier may adopt any manner that can play a role of identification, may be a manner of letter, number, or a combination of the two, and may also adopt magic number as the request identifier, and since the magic number can be used for identifying the characteristics of the information, it may be used as the request identifier of the network request, which is reasonable, and is not specifically limited herein.
Further, the terminal may send the network request with the request identifier added to the server, that is, execute step S304, and the server may receive the network request, determine whether the request identifier matches with the request identifier recorded by the server, and then respond to the network request according to the matching result and the preset network interface calling rule. Wherein the recorded request identifier is: and the server receives the request identifier carried by the network request before receiving the network request. In this way, the server may determine whether the network request is duplicate with a previously received network request. Therefore, the condition that the same network request obtains different response results can be avoided, and the accuracy of the response results of the network request is improved.
As an implementation manner of the embodiment of the present invention, the method may further include:
receiving a response result sent by the server; and recording response information of the network request based on the request identification and the response time of the network request.
The response result may carry the request identifier and the response time of the network request. Therefore, the terminal can record the response information of the network request based on the request identification and the response time of the network request.
For example, after the response of the data backup network request a0 is completed, the server sends the response result of the data backup network request a0 to the terminal, and the response result includes the request identifier a1 and the response time 10. The terminal may record the response information of network request a0 as: request identification: a 1; response time: 10 points; requesting the content: and backing up the data.
Therefore, in this embodiment, after responding to the network request, the server may send a response result of the network request to the terminal, and the terminal may record response information of the network request based on the request identifier and the response time of the network request, so that the user can conveniently check the response condition of the network request.
Corresponding to the processing method of the network request, the embodiment of the invention also provides a processing device of the network request.
The following describes a processing apparatus for a network request according to an embodiment of the present invention.
As shown in fig. 4, an apparatus for processing a network request is applied to a server, and the apparatus includes:
a request receiving module 410, configured to receive a network request sent by a terminal, where the network request carries a request identifier of the network request;
an identifier matching module 420, configured to determine whether the request identifier matches a recorded request identifier, to obtain a matching result, where the recorded request identifier is: the request identifier carried by other network requests received by the server before the network request is received;
a request response module 430, configured to respond to the network request according to the matching result.
Therefore, in the scheme provided by the embodiment of the invention, the server can firstly receive the network request sent by the terminal, then judge whether the request identifier carried in the network request is matched with the recorded request identifier to obtain the matching result, and then respond to the network request according to the matching result. Since the recorded request identification is: the electronic equipment can identify repeated network requests according to the matching condition of the request identifier of the network request and the recorded request identifier, and then can respond to the network request in a proper processing mode according to the matching result, so that the condition that the same network request obtains different response results is avoided, and the problem that the response result of the network request is disordered is avoided.
As an implementation manner of the embodiment of the present invention, the request response module 430 may include:
a response unit (not shown in fig. 4) configured to invoke a specific network interface to respond to the network request if the request identifier matches the recorded request identifier, where the specific network interface is: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier in the recorded request identifiers.
As an implementation manner of the embodiment of the present invention, the recorded request identifier corresponds to a reception time point of a network request;
the identity matching module 420 may include:
an alternative network request determining unit (not shown in fig. 4) configured to determine, according to the recorded receiving time point, a network request received within a first preset time period as an alternative network request;
a time point acquisition unit (not shown in fig. 4) for acquiring a reception time point of the network request;
a time period determining unit (not shown in fig. 4) configured to determine a time period to be matched according to a receiving time point of the network request;
and an identifier matching unit (not shown in fig. 4) configured to determine whether the request identifier of the network request matches a recorded request identifier corresponding to the receiving time point located in the time period to be matched.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
an identity recording module (not shown in fig. 4) for recording the request identity if the request identity does not match the recorded request identity.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
a deleting module (not shown in fig. 4) configured to delete a part of all recorded request identifiers according to a first preset manner; or deleting all recorded request identifications according to a second preset mode.
As an implementation manner of the embodiment of the present invention, the deleting module may include:
and a first deleting unit (not shown in fig. 4) configured to delete the request identifier that is not successfully matched within a second preset time period from among the request identifiers of the recorded network requests.
As an implementation manner of the embodiment of the present invention, the deleting module may include:
and a second deleting unit (not shown in fig. 4) configured to delete all recorded request identifiers at the end of the current period according to the preset period.
As an implementation manner of the embodiment of the present invention, the identifier matching module 420 may include:
an identifier matching unit (not shown in fig. 4) configured to determine whether the request identifier matches a recorded request identifier if the network request is received within a predetermined time after the server is restarted; or, if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
a response result sending module (not shown in fig. 4) configured to send a response result of the network request to the terminal, where the response result carries the request identifier and the response time of the network request.
Corresponding to the method for sending the network request, the embodiment of the invention also provides a device for sending the network request.
The following describes a network request sending apparatus according to an embodiment of the present invention.
As shown in fig. 5, an apparatus for sending a network request is applied to a terminal, and the apparatus includes:
an instruction obtaining module 510, configured to obtain an operation instruction of a user;
a request generating module 520, configured to generate a network request corresponding to the operation instruction according to the operation instruction;
an identifier adding module 530, configured to add a request identifier to the network request, where the network request corresponds to the request identifier one to one;
a request sending module 540, configured to send a network request to a server after adding a request identifier, so that the server determines whether the request identifier matches the request identifier recorded by the server, and responds to the network request according to the matching result;
wherein the recorded request identification is: and the request identifier carried by other network requests received by the server before the network request is received.
Therefore, in the scheme provided by the embodiment of the invention, the terminal can firstly acquire the operation instruction of the user, generate the network request corresponding to the operation instruction according to the operation instruction, add the request identifier to the network request, and further send the network request added with the request identifier to the server. Because the request identifier can identify the network request, when the terminal sends the repeated network request to the server, the server can identify the repeated network request according to the request identifier, thereby avoiding the situation that the same network request obtains different response results and avoiding the problem that the response result of the network request is disordered.
The embodiment of the present invention further provides a server, as shown in fig. 6, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 complete mutual communication through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to implement the following steps when executing the program stored in the memory 603:
receiving a network request sent by a terminal, wherein the network request carries a request identifier of the network request;
judging whether the request identifier is matched with the recorded request identifier to obtain a matching result, wherein the recorded request identifier is as follows: the request identifier carried by other network requests received by the server before the network request is received;
and responding to the network request according to the matching result.
Therefore, in the scheme provided by the embodiment of the invention, the server can firstly receive the network request sent by the terminal, then judge whether the request identifier carried by the network request is matched with the recorded request identifier to obtain the matching result, and then respond to the network request according to the matching result. Since the recorded request identification is: the electronic equipment can identify repeated network requests according to the matching condition of the request identifier of the network request and the recorded request identifier, and can respond to the network requests in a proper processing mode according to the matching result, so that the condition that the same network requests obtain different response results is avoided, and the problem that the response results of the network requests are disordered is avoided.
The communication bus mentioned in the above server may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this is not intended to represent only one bus or type of bus.
The communication interface is used for communication between the server and other devices.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The step of responding to the network request according to the matching result may include:
if the request identification is matched with the recorded request identification, calling a specific network interface to respond to the network request, wherein the specific network interface is as follows: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier in the recorded request identifiers.
Wherein, the recorded request identifier may correspond to a receiving time point of the network request;
the step of determining whether the request identifier matches the recorded request identifier may include:
acquiring a receiving time point of the network request;
determining a time period to be matched according to the receiving time point of the network request;
and judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
Wherein, the method can also comprise:
and recording the request identification if the request identification does not match the recorded request identification.
Wherein, the method can also comprise:
deleting a part of all recorded request identifications according to a first preset mode; or deleting all recorded request identifications according to a second preset mode.
The step of deleting a part of all recorded request identifiers according to the first preset manner may include:
and deleting the request identifications which are not matched successfully in a second preset time period from the recorded request identifications of the network request.
The step of deleting all recorded request identifiers according to the second preset manner may include:
and deleting all recorded request identifications at the end of the current period according to a preset period.
The step of determining whether the request identifier matches the recorded request identifier may include:
if the network request is received within a preset time after the server is restarted, judging whether the request identifier is matched with the recorded request identifier;
or the like, or a combination thereof,
and if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
Wherein, the method can also comprise:
receiving a response result sent by the server, wherein the response result carries a request identifier and response time of the network request;
and recording response information of the network request based on the request identification and the response time of the network request.
The embodiment of the present invention further provides a terminal, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
acquiring an operation instruction of a user;
generating a network request corresponding to the operation instruction according to the operation instruction;
adding request identifications to the network request, wherein the network request corresponds to the request identifications one to one;
sending a network request added with a request identifier to a server so that the server judges whether the request identifier is matched with the request identifier recorded by the server or not, and responding to the network request according to the matching result;
wherein the recorded request identification is: and the request identifier carried by other network requests received by the server before the network request is received.
Therefore, in the scheme provided by the embodiment of the invention, the terminal can firstly acquire the operation instruction of the user, generate the network request corresponding to the operation instruction according to the operation instruction, add the request identifier to the network request, and further send the network request added with the request identifier to the server. Because the request identifier can identify the network request, when the terminal sends the repeated network request to the server, the server can identify the repeated network request according to the request identifier, thereby avoiding the situation that the same network request obtains different response results and avoiding the problem that the response result of the network request is disordered.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Wherein, the method can also comprise:
receiving a response result sent by the server, wherein the response result carries a request identifier and response time of the network request;
and recording response information of the network request based on the request identification and the response time of the network request.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when executed by a processor, the computer program implements the following steps:
receiving a network request sent by a terminal, wherein the network request carries a request identifier of the network request;
judging whether the request identifier is matched with the recorded request identifier to obtain a matching result, wherein the recorded request identifier is as follows: the request identification carried by the server when receiving other network requests received by the server before receiving the network request;
and responding to the network request according to the matching result.
It can be seen that, in the solution provided in the embodiment of the present invention, when the computer program is executed by the processor, the computer program may first receive a network request sent by the terminal, then determine whether a request identifier carried in the network request matches a recorded request identifier, obtain a matching result, and then respond to the network request according to the matching result. Since the recorded request identification is: the electronic equipment can identify repeated network requests according to the matching condition of the request identifier of the network request and the recorded request identifier, and then can respond to the network request by adopting a proper processing mode according to the matching result, so that the condition that the same network request obtains different response results is avoided, and the problem that the response result of the network request is disordered is avoided.
The step of responding to the network request according to the matching result may include:
if the request identification is matched with the recorded request identification, calling a specific network interface to respond to the network request, wherein the specific network interface is as follows: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier in the recorded request identifiers.
Wherein, the recorded request identifier may correspond to a receiving time point of the network request;
the step of determining whether the request identifier matches the recorded request identifier may include:
acquiring a receiving time point of the network request;
determining a time period to be matched according to the receiving time point of the network request;
and judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
Wherein, the method can also comprise:
and recording the request identification if the request identification does not match the recorded request identification.
Wherein, the method can also comprise:
deleting a part of all recorded request identifications according to a first preset mode; or deleting all recorded request identifications according to a second preset mode.
The step of deleting a part of all recorded request identifiers according to the first preset manner may include:
and deleting the request identifications which are not matched successfully in a second preset time period from the recorded request identifications of the network request.
The step of deleting all recorded request identifiers according to the second preset manner may include:
and deleting all recorded request identifications at the end of the current period according to a preset period.
The step of determining whether the request identifier matches the recorded request identifier may include:
if the network request is received within a preset time after the server is restarted, judging whether the request identifier is matched with the recorded request identifier;
or the like, or, alternatively,
and if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
Wherein, the method can also comprise:
receiving a response result sent by the server, wherein the response result carries a request identifier and response time of the network request;
and recording response information of the network request based on the request identification and the response time of the network request.
An embodiment of the present invention further provides another computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the following steps:
acquiring an operation instruction of a user;
generating a network request corresponding to the operation instruction according to the operation instruction;
adding request identifications to the network request, wherein the network request corresponds to the request identifications one to one;
sending a network request added with a request identifier to a server so that the server judges whether the request identifier is matched with the request identifier recorded by the server or not, and responding to the network request according to the matching result and a preset network interface calling rule;
wherein the recorded request identification is: and the request identifier carried by other network requests received by the server before the network request is received.
It can be seen that, in the solution provided in the embodiment of the present invention, when the computer program is executed by the processor, the computer program may first obtain an operation instruction of the user, generate a network request corresponding to the operation instruction according to the operation instruction, add a request identifier to the network request, and then send the network request after adding the request identifier to the server. Because the request identifier can identify the network request, when the terminal sends the repeated network request to the server, the server can identify the repeated network request according to the request identifier, thereby avoiding the situation that the same network request obtains different response results and avoiding the problem that the response result of the network request is disordered.
Wherein, the method can also comprise:
receiving a response result sent by the server, wherein the response result carries a request identifier and response time of the network request;
and recording response information of the network request based on the request identification and the response time of the network request.
It should be noted that, for the above-mentioned apparatus, server, terminal and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant points, refer to the partial description of the method embodiments.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (19)

1. A method for processing a network request is applied to a server, and the method comprises the following steps:
receiving a network request sent by a terminal, wherein the network request carries a request identifier of the network request;
judging whether the request identifier is matched with the recorded request identifier to obtain a matching result, wherein the recorded request identifier is as follows: the request identifier carried by other network requests received by the server before the network request is received; the recorded request identification corresponds to a receiving time point of the network request;
responding to the network request according to the matching result;
the step of judging whether the request identifier is matched with the recorded request identifier includes:
acquiring a receiving time point of the network request;
determining a time period to be matched according to the receiving time point of the network request;
and judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
2. The method of claim 1, wherein said step of responding to said network request based on said matching comprises:
if the request identification is matched with the recorded request identification, calling a specific network interface to respond to the network request, wherein the specific network interface is as follows: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier in the recorded request identifiers.
3. The method of claim 1, wherein the method further comprises:
and recording the request identification if the request identification does not match the recorded request identification.
4. The method of claim 1, wherein the method further comprises:
deleting the request identifiers which are not successfully matched in a second preset time period in the recorded request identifiers;
and/or
And deleting all recorded request identifications at the end of the current period according to a preset period.
5. The method of claim 1, wherein said step of determining whether said request identification matches a recorded request identification comprises:
if the network request is received within a preset time after the server is restarted, judging whether the request identifier is matched with the recorded request identifier;
or the like, or, alternatively,
and if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
6. The method of any one of claims 1-5, further comprising:
and sending a response result of the network request to the terminal, wherein the response result carries the request identifier and the response time of the network request.
7. A method for sending a network request is applied to a terminal, and comprises the following steps:
acquiring an operation instruction of a user;
generating a network request corresponding to the operation instruction according to the operation instruction;
adding request identifications to the network request, wherein the network request corresponds to the request identifications one to one;
sending a network request added with a request identifier to a server so that the server judges whether the request identifier is matched with the request identifier recorded by the server or not, and responding to the network request according to the matching result;
wherein the recorded request identification is: the request identifier carried by other network requests received by the server before the network request is received; the recorded request identification corresponds to a receiving time point of the network request;
the step of judging whether the request identifier is matched with the recorded request identifier includes:
acquiring a receiving time point of the network request;
determining a time period to be matched according to the receiving time point of the network request;
and judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
8. The method of claim 7, wherein the method further comprises:
receiving a response result sent by the server, wherein the response result carries a request identifier and response time of the network request;
and recording response information of the network request based on the request identification and the response time of the network request.
9. An apparatus for processing a network request, applied to a server, the apparatus comprising:
a request receiving module, configured to receive a network request sent by a terminal, where the network request carries a request identifier of the network request;
an identifier matching module, configured to determine whether the request identifier matches a recorded request identifier, to obtain a matching result, where the recorded request identifier is: the request identifier carried by other network requests received by the server before the network request is received; the recorded request identification corresponds to a receiving time point of the network request;
the request response module is used for responding to the network request according to the matching result;
the identification matching module comprises:
a time point obtaining unit, configured to obtain a receiving time point of the network request;
the time period determining unit is used for determining a time period to be matched according to the receiving time point of the network request;
and the identifier matching unit is used for judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
10. The apparatus of claim 9, wherein the request response module comprises:
a response unit, configured to invoke a specific network interface to respond to the network request if the request identifier matches a recorded request identifier, where the specific network interface is: and the network interface is used for responding to the network request corresponding to the request identifier matched with the request identifier in the recorded request identifiers.
11. The apparatus of claim 9, wherein the apparatus further comprises:
and the identification recording module is used for recording the request identification if the request identification is not matched with the recorded request identification.
12. The apparatus of claim 9, wherein the apparatus further comprises:
the deleting module is used for deleting the request identifiers which are not successfully matched in a second preset time period in the recorded request identifiers; and/or deleting all recorded request identifications at the end of the current period according to a preset period.
13. The apparatus of claim 9, wherein the identity matching module comprises:
the identification matching unit is used for judging whether the request identification is matched with the recorded request identification or not if the network request is received within the preset time after the server is restarted; or, if the current network condition is determined to be abnormal, judging whether the request identification is matched with the recorded request identification.
14. The apparatus of any of claims 9-13, further comprising:
and the response result sending module is used for sending a response result of the network request to the terminal, wherein the response result carries the request identifier and the response time of the network request.
15. An apparatus for sending a network request, applied to a terminal, the apparatus comprising:
the instruction acquisition module is used for acquiring an operation instruction of a user;
the request generation module is used for generating a network request corresponding to the operation instruction according to the operation instruction;
an identifier adding module, configured to add a request identifier to the network request, where the network request corresponds to the request identifier one to one;
the request sending module is used for sending the network request added with the request identifier to a server so as to enable the server to judge whether the request identifier is matched with the request identifier recorded by the server or not, and responding to the network request according to the matching result;
wherein the recorded request identification is: the request identifier carried by other network requests received by the server before the network request is received; the recorded request identification corresponds to a receiving time point of a network request;
the step of judging whether the request identifier is matched with the recorded request identifier includes:
acquiring a receiving time point of the network request;
determining a time period to be matched according to the receiving time point of the network request;
and judging whether the request identifier of the network request is matched with the recorded request identifier corresponding to the receiving time point in the time period to be matched.
16. The apparatus of claim 15, wherein the apparatus further comprises:
a response result receiving module, configured to receive a response result sent by the server, where the response result carries a request identifier and response time of the network request;
and the response information recording module is used for recording the response information of the network request based on the request identification and the response time of the network request.
17. A server is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing the communication between the processor and the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
18. A terminal is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing the communication between the processor and the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 7 to 8 when executing a program stored in the memory.
19. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 6 or 7 to 8.
CN201811590793.1A 2018-12-21 2018-12-21 Network request processing and sending method and device Active CN111355765B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811590793.1A CN111355765B (en) 2018-12-21 2018-12-21 Network request processing and sending method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811590793.1A CN111355765B (en) 2018-12-21 2018-12-21 Network request processing and sending method and device

Publications (2)

Publication Number Publication Date
CN111355765A CN111355765A (en) 2020-06-30
CN111355765B true CN111355765B (en) 2022-06-03

Family

ID=71195606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811590793.1A Active CN111355765B (en) 2018-12-21 2018-12-21 Network request processing and sending method and device

Country Status (1)

Country Link
CN (1) CN111355765B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112511565B (en) * 2021-01-29 2021-05-11 腾讯科技(深圳)有限公司 Request response method and device, computer readable storage medium and electronic equipment
CN113704592B (en) * 2021-08-02 2023-10-17 北京达佳互联信息技术有限公司 Network request sending method and device, electronic equipment and storage medium
CN113709248B (en) * 2021-08-30 2023-11-21 广州大通和亿科技有限公司 Service request processing method, system, front-end and server-side service processing device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908695A (en) * 2017-10-31 2018-04-13 平安普惠企业管理有限公司 Operation system operation method, device, system and readable storage medium storing program for executing
CN108696579A (en) * 2018-04-28 2018-10-23 北京奇艺世纪科技有限公司 A kind of request responding method, device and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10603594B2 (en) * 2016-12-07 2020-03-31 Microsoft Technology Licensing, Llc Online ecosystem-based resource recommendations

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908695A (en) * 2017-10-31 2018-04-13 平安普惠企业管理有限公司 Operation system operation method, device, system and readable storage medium storing program for executing
CN108696579A (en) * 2018-04-28 2018-10-23 北京奇艺世纪科技有限公司 A kind of request responding method, device and electronic equipment

Also Published As

Publication number Publication date
CN111355765A (en) 2020-06-30

Similar Documents

Publication Publication Date Title
WO2021180025A1 (en) Message processing method and apparatus, electronic device and medium
CN111355765B (en) Network request processing and sending method and device
CN113364853B (en) Business service system, business request method and gateway equipment
CN110022259B (en) Message arrival rate determining method and device, data statistics server and storage medium
CN109361525B (en) Method, device, control terminal and medium for restarting distributed deployment of multiple services
CN111581502A (en) Information notification method and device
CN106339267A (en) Object query method and server side
CN108108126B (en) Data processing method, device and equipment
CN113067853A (en) Data pushing method and device, electronic equipment and storage medium
CN112835885B (en) Processing method, device and system for distributed form storage
CN108132836B (en) Task distribution method and device and electronic equipment
CN111367694A (en) Event processing method, server and computer storage medium
CN110955460B (en) Service process starting method and device, electronic equipment and storage medium
CN109391658B (en) Account data synchronization method and equipment, storage medium and terminal thereof
CN110674153B (en) Data consistency detection method and device and electronic equipment
CN106933932B (en) Data processing method and device and application server
CN110727895B (en) Sensitive word sending method and device, electronic equipment and storage medium
CN110427538B (en) Data query method, data storage method, data query device, data storage device and electronic equipment
WO2020063769A1 (en) User request processing method and apparatus and server
CN110309028B (en) Monitoring information acquisition method, service monitoring method, device and system
CN114090268B (en) Container management method and container management system
CN111291127B (en) Data synchronization method, device, server and storage medium
CN109254855B (en) Registration method and device of parameter transmission protocol and electronic equipment
CN114185804A (en) Interface testing method and device and terminal equipment
CN110990694B (en) Recommendation method, device and system

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