CN110891090B - Request method, device, server, system and storage medium - Google Patents

Request method, device, server, system and storage medium Download PDF

Info

Publication number
CN110891090B
CN110891090B CN201911201314.7A CN201911201314A CN110891090B CN 110891090 B CN110891090 B CN 110891090B CN 201911201314 A CN201911201314 A CN 201911201314A CN 110891090 B CN110891090 B CN 110891090B
Authority
CN
China
Prior art keywords
request
server
result
request result
cache
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
CN201911201314.7A
Other languages
Chinese (zh)
Other versions
CN110891090A (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 SoundAI Technology Co Ltd
Original Assignee
Beijing SoundAI 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 SoundAI Technology Co Ltd filed Critical Beijing SoundAI Technology Co Ltd
Priority to CN201911201314.7A priority Critical patent/CN110891090B/en
Publication of CN110891090A publication Critical patent/CN110891090A/en
Application granted granted Critical
Publication of CN110891090B publication Critical patent/CN110891090B/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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

According to the request method, the request device, the server system and the storage medium, when the server receives a request sent by a client, whether a historical request result of the request exists in a cache of the server is detected; if the history request result of the request in the cache of the server side is detected, executing a first operation according to the history request result; and if the historical request result of the request does not exist in the cache of the server side, processing the request to obtain a request result, and executing a second operation by using the request result. According to the method and the device, under the condition that the historical request result of the request is stored in the server cache, the request can not be processed, and corresponding operation is directly executed based on the historical request result, so that the purpose of improving the request response efficiency can be achieved on the premise of considering the accuracy of the request result.

Description

Request method, device, server, system and storage medium
Technical Field
The present invention relates to the field of speech processing technologies, and in particular, to a request method, apparatus, server, system, and storage medium.
Background
The existing interaction mode between the client and the server is that the client sends a request to the server, and the server responds to the request to perform corresponding data processing to obtain a request result and returns the request result to the client. The mode of processing data for each request not only increases the calculation amount of the server, but also reduces the request response efficiency of the server. Particularly, in a voice service (such as a voice-to-text service), the amount of information involved in the data processing process is large, the data processing time is long, and when there are many requests, even a situation that the request result cannot be fed back to the client in time may occur.
Disclosure of Invention
In view of this, the present invention provides a request method, device, server, system and storage medium, so as to improve the request response efficiency while considering the accuracy of the request result.
In order to achieve the above object, the following solutions are proposed:
a method of requesting, comprising:
when a request sent by a client is received, detecting whether a historical request result of the request exists in a cache of a server;
if the historical request result of the request exists in the cache of the server side, executing a first operation according to the historical request result;
and if the historical request result of the request does not exist in the cache of the server side, processing the request to obtain a request result, and executing a second operation by using the request result.
Preferably, the executing the first operation according to the history request result includes:
judging whether preset data processing conditions are met or not at present;
if the data processing condition is met currently, comparing the historical request result with the request result obtained by processing the request to obtain a comparison result, and executing operation matched with the comparison result;
and if the data processing condition is not met currently, returning the history request result to the client.
Preferably, the performing the operation matching the comparison result includes:
if the comparison result represents that the historical request result is different from the request result, returning the request result to the client, updating the historical request result into the request result, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration;
and if the comparison result represents that the historical request result is the same as the request result, returning the historical request result to the client.
Preferably, the performing the second operation by using the request result includes: and returning the request result to the client, storing the request result to the server cache, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration.
Preferably, the process of sending the request by the client includes:
when a request to be sent exists in the client, detecting whether a first service terminal IP address used for receiving the request sent by the client is stored in a client cache or not;
if the first server IP address is not stored in the client cache, performing domain name resolution to obtain a second server IP address, sending the request to a server indicated by the second server IP address, and storing the second server IP address into the client cache;
and if the first service end IP address is stored in the client cache, sending the request to a service end indicated by the first service end IP address.
Preferably, the method further comprises the following steps:
and if the storage time of the second server IP address in the client cache reaches a second preset time, deleting the second server IP address from the client cache.
Preferably, the judging whether the preset data processing condition is currently met includes:
generating a random factor;
judging whether the random factor meets preset data processing conditions or not;
if the random factor meets the data processing condition, determining that the data processing condition is met currently;
and if the random factor does not meet the data processing condition, determining that the data processing condition is not met currently.
Preferably, the judging whether the random factor meets a preset data processing condition includes:
judging whether the random factor exceeds a preset random factor threshold value;
if the random factor exceeds the random factor threshold, determining that the random factor meets preset data processing conditions;
and if the random factor does not exceed the random factor threshold, determining that the random factor does not meet the preset data processing condition.
A requesting device, comprising:
the history request result detection unit is used for detecting whether a history request result of the request exists in a cache of a server side when the request sent by the client side is received;
the first execution unit is used for executing a first operation according to a history request result if the history request result of the request is detected to exist in the cache of the server;
and the second execution unit is used for processing the request to obtain a request result and executing a second operation by using the request result if the historical request result of the request does not exist in the cache of the server.
A request server, at least one memory and at least one processor; the memory stores a program, and the processor invokes the program stored by the memory, the program being for implementing the requested method.
A request system, comprising: a client and the server.
A computer-readable storage medium having computer-executable instructions stored therein for performing the method of requesting.
According to the request method, the request device, the server, the system and the storage medium, when the server receives a request sent by a client, whether a historical request result of the request exists in a cache of the server is detected; if the historical request result of the request exists in the cache of the server side, executing a first operation according to the historical request result; and if the historical request result of the request does not exist in the cache of the server side, processing the request to obtain a request result, and executing a second operation by using the request result. According to the method and the device, under the condition that the historical request result of the request is stored in the cache of the server, the request can be not processed, and corresponding operation is directly executed based on the historical request result, so that the purpose of improving the request response efficiency can be achieved on the premise of considering the accuracy of the request result.
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 embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a request system according to an embodiment of the present application;
fig. 2 is a flowchart of a request method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for performing a first operation according to a history request result according to an embodiment of the present application;
fig. 4 is a flowchart of a method for a client to send a request according to an embodiment of the present disclosure;
fig. 5 is a flowchart of a method for determining whether a preset data processing condition is currently satisfied according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a requesting device according to an embodiment of the present application;
fig. 7 is a block diagram of a hardware structure of a server according to an embodiment of the present application.
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 obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Example (b):
the embodiment of the application provides a request method, a request device, a server, a request system and a storage medium, so as to solve the problem of low request response efficiency of the server in the prior art, and achieve the purpose of improving the request response efficiency on the premise of considering the accuracy of the request result.
The present application is described in detail below from the perspective of the requesting system. Specifically, fig. 1 is a schematic structural diagram of a request system provided in an embodiment of the present application.
As shown in fig. 1, the system includes: the system comprises a server and terminal equipment provided with a client, wherein the server provides technical support for the client installed on the terminal equipment.
As a preferred implementation of the embodiment of the present application, an interaction manner between the server and the client is as follows:
from the client perspective: when a request to be sent exists in a client, detecting whether a server IP address used for receiving the request sent by the client is stored in a client cache (for convenience of distinguishing, the detected server IP address is temporarily called as a first server IP address in the application file); if the client cache does not store the first server IP address, performing domain name resolution to obtain a server IP address (for convenience of distinguishing, the server IP address obtained through resolution is temporarily called a second server IP address in the document of the application), sending a request to a server indicated by the second server IP address, storing the second server IP address in the client cache, and deleting the second server IP address from the client cache when the storage duration of the second server IP address in the client cache reaches a second preset duration.
In the embodiment of the present application, the second preset time period may be one day, two days, and the like, the above is only a preferred value of the second preset time period provided in the embodiment of the present application, and the inventor may set the specific value of the second preset time period according to his own requirement, which is not limited herein.
As a preferred implementation manner of the embodiment of the present application, the client-side cache is a client-side cache and is used for storing the server-side IP address, so that when the client sends a request, if the client acquires the server-side IP address used for receiving the request from the client-side cache, a process of performing domain name resolution to acquire the server-side IP address used for receiving the request may be avoided, and request efficiency is improved.
In this embodiment, the second server IP address may be the same as or different from the first server IP address.
From the server perspective: when the server receives a request sent by the client, detecting whether a history request result of the request exists in a cache of the server; and if the historical request result of the request is detected to exist in the server cache, executing a first operation according to the historical request result, and if the historical request result of the request is detected not to exist in the server cache, processing the request to obtain a request result, and executing a second operation by using the request result.
In this embodiment of the present application, when it is detected that a history request result of a request exists in a server cache, a process of executing a first operation according to the history request result may be: judging whether preset data processing conditions are met or not at present, if the preset data processing conditions are met at present, comparing a historical request result with a processing request to obtain a request result to obtain a comparison result, returning the request result to the client when the comparison result represents that the request result is different from the historical request result, updating the historical request result into the request result, and deleting the request result from the server cache when the storage duration of the request result at the server reaches a first preset duration; and if the current data processing condition is not met or the request result is the same as the historical request result, returning the historical request result to the client.
In this embodiment of the present application, when it is detected that there is no history request result of the request in the server cache, the processing of the request obtains the request result, and the process of executing the second operation using the request result may be: and returning a request result to the client, storing the request result to a server cache, and deleting the request result from the server cache when the storage duration of the server cache reaches a first preset duration.
In the embodiment of the present application, the first preset time period may be one day, two days, and the like, the above is only a preferred value of the first preset time period provided in the embodiment of the present application, and the inventor may set the specific value of the first preset time period according to his own requirement, which is not limited herein. The first preset time period may be the same as or different from the second preset time period.
As a preferred implementation of the embodiment of the present application, the server-side cache is a cache on the server side, and is used for storing a request result of the request, and the request result of the request may be referred to as a history request result after being stored in the server-side cache. Therefore, after receiving a request sent by a client, a server can judge whether a historical request result of the request is stored in a cache of the server or not, and if the historical request result of the request is stored in the cache of the server, whether the historical request result is directly returned to the client or the request result of the request is returned to the client after the correctness of the historical request result is verified is determined according to whether the current result of the data processing condition is met.
In the embodiment of the application, when the server receives a request sent by a client, whether a historical request result of the request exists in a cache of the server is detected; if the history request result of the request in the cache of the server side is detected, executing a first operation according to the history request result; and if the historical request result of the request does not exist in the cache of the server side, processing the request to obtain the request result, and executing a second operation by using the request result. According to the method and the device, under the condition that the historical request result of the request is stored in the cache of the server, the request can be not processed, and corresponding operation is directly executed based on the historical request result, so that the purpose of improving the request response efficiency can be achieved on the premise of considering the accuracy of the request result.
And under the condition that the client stores the first server IP address for receiving the request in the client cache, the client can directly send the request to the server indicated by the first server IP address without domain name resolution, so that the request response efficiency is further improved.
In order to facilitate understanding of a request method provided by the embodiment of the present application, a detailed description will now be made of the request method provided by the embodiment of the present application from the perspective of a server.
Fig. 2 is a flowchart of a request method according to an embodiment of the present application.
As shown in fig. 2, the method includes:
s201, when a request sent by a client is received, detecting whether a historical request result of the request exists in a cache of a server; if the historical request result of the request exists in the cache of the server side, executing the step S202; if it is detected that the historical request result of the request does not exist in the server cache, step 203 is executed.
In the embodiment of the present application, preferably, when there is a request to be sent, the client may obtain a server IP address for receiving the request, and further send the request to the server indicated by the server IP address. Specifically, for a manner that when there is a request to be sent by a client, the client acquires an IP address of a server for receiving the request, please refer to the detailed description in fig. 4, which is not described herein again.
Correspondingly, the request method provided by the embodiment of the application is applied to the server side for receiving the request sent by the client side.
In the embodiment of the present application, preferably, the server-side cache may be considered as a server-side cache, for example, a cache local to the server. Correspondingly, as a preferred implementation manner of the embodiment of the present application, it may be detected whether a history request result of a request exists in a local cache of a server. If the historical request result of the request exists in the local cache of the server, executing the step S202; if it is detected that the historical request result of the request does not exist in the local cache of the server, step S203 is executed.
And S202, executing a first operation according to the history request result.
Fig. 3 is a flowchart illustrating a method for executing a first operation according to a history request result according to an embodiment of the present application.
As shown in fig. 3, the method specifically includes the following steps:
s301, judging whether preset data processing conditions are met or not at present; if the data processing condition is currently satisfied, executing step S302; if the data processing condition is not satisfied currently, executing step S303;
s302, comparing the historical request result with the request result obtained by processing the request to obtain a comparison result, and executing operation matched with the comparison result;
in the specific process of executing step S302, if the data processing condition is currently satisfied, the request is subjected to data processing in response to the request to obtain a request result of the request, and then the history request result and the request result are compared to obtain a comparison result, and an operation matching the comparison result is executed.
In the application embodiment, preferably, if the comparison result represents that the historical request result is different from the request result obtained by performing data processing on the request, the request result is returned to the client, the historical request result is updated to the request result, and the request result is deleted from the server cache when the storage duration of the request result in the server cache reaches a first preset duration; and if the comparison result represents that the historical request result is the same as the request result obtained by data processing of the request, returning the historical request result to the client.
As a preferred implementation manner of the embodiment of the present application, if a request result obtained by performing data processing on a request is different from a history request result of a request obtained from a server cache, the history request result in the server cache may be deleted, and the request result may be stored in the server cache.
It should be noted that: the request method provided by the embodiment of the application can monitor the time length for storing the request result into the server cache (namely, the storage time length of the request result in the server cache), and when the time length reaches the first preset time length, the request result is deleted from the server cache. Therefore, the validity of the historical request result stored in the cache of the server side is ensured; the problem that the historical request result is invalid due to the fact that the historical request result is stored in the server cache for too long time is solved. For example, if processing data in the database is involved in processing data in the database in response to a request, the data in the database may be updated as time increases, and if a historical request result cached by the server is considered to be valid all the time, a problem that a request result returned to the client is inaccurate may be caused.
Further, in this embodiment of the present application, if the comparison result represents that the historical request result is the same as the request result obtained by performing data processing on the request, any one of the request result and the historical request result may be returned to the client.
And S303, returning a history request result to the client.
In the specific execution of step S303, if the data processing condition is not currently satisfied, the history request result is returned to the client.
S203: the request is processed to obtain a request result, and a second operation is executed by using the request result.
In this embodiment of the present application, preferably, when there is no history request result of the request in the cache of the server, the process of performing the second operation by using the request result may be: and when the historical request result of the request does not exist in the server cache, responding the request, performing data processing on the request to obtain a request result, returning the request result to the client, storing the request result to the server cache, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration.
Fig. 4 is a flowchart of a method for sending a request by a client according to an embodiment of the present application.
As shown in fig. 4, the method includes:
s401, when a request to be sent exists in a client, detecting whether a first service end IP address used for receiving the request sent by the client is stored in a client cache; if the first server IP address for receiving the request sent by the client is not stored in the client cache, step S402 is executed; if the client cache stores a first server IP address for receiving a request sent by the client, step S403 is executed;
in the embodiment of the present application, the client cache may be regarded as a client-side cache, such as a cache local to the client. When a request to be sent exists in a client, whether a first service end IP address used for receiving the request sent by the client is stored in a local cache of the client can be detected; if the first service end IP address is not stored in the local cache of the client end, executing the step S402; if the first server IP address is stored in the client local cache, step S403 is executed.
In the embodiment of the present application, a Domain Name Service (DNS) cache may be set on the client in advance, for example, if the DNS cache is set on the client in advance, the DNS cache may be used as a local cache of the client, and when a request to be sent exists in the client, whether a first server IP address used for receiving the request sent by the client is stored in the DNS cache may be detected; if the DNS cache does not store the first service end IP address, step S402 is executed; if the DNS cache stores the first server IP address, step S403 is executed.
It should be noted that the DNS caching mode may be: when a certain website is visited for the first time (for example 163. Com), if the IP address returned by the DNS is the correct IP address, the returned correct IP address is stored in the DNS cache.
It should be noted that: after the server IP address is stored in the client cache, the time length for storing the server IP address in the client cache (namely, the storage time length of the server IP address in the client cache) can be monitored, and when the time length reaches a second preset time length, the server IP address is deleted from the client cache, so that the validity of the server IP address is ensured, and the problem that the server IP address stored in the client cache fails after the server for receiving the request sent by the client is changed due to various reasons is solved.
S402, performing domain name resolution to obtain a second server IP address, sending a request to a server indicated by the second server IP address, and storing the second server IP address into a client cache;
when the first server IP address is not stored in the client cache, domain name resolution may be performed to obtain a second server IP address for receiving a request sent by the client, and the request is sent to the server indicated by the second server IP address.
In this embodiment of the present application, when the first server IP address is not stored in the client cache, the manner of performing domain name resolution to obtain the second server IP address for receiving the request sent by the client may be: and when the first server IP address is not stored in the client cache, performing DNS analysis to obtain a second server IP address for receiving a request sent by the client.
Further, in the embodiment of the present application, the second server IP address may be stored in the client cache, so that when a request to be sent exists in a subsequent client, if a server IP address is queried in the client cache, the request is sent to a server indicated by the queried server IP address, where the queried server IP address may be considered as the first server IP address.
It should be noted that, if a DNS cache is preset, the DNS cache may be used as a client cache, and further, the second server address may be stored in the DNS cache, so that when a subsequent client has a request to be sent, if an IP address of a server is queried in the DNS cache, the request is sent to a server indicated by the queried IP address.
It should be noted that: after the server IP address is stored in the client cache, the time length for storing the server IP address in the client cache (namely, the storage time length of the server IP address in the client cache) can be monitored, and when the time length reaches a second preset time length, the server IP address is deleted from the client cache, so that the validity of the server IP address is ensured, and the problem that the server IP address stored in the client cache fails after the server for receiving the request sent by the client is changed due to various reasons is solved.
S403, sending a request to the server indicated by the IP address of the first server.
In the embodiment of the application, based on the server IP address cached in the client cache and used for receiving the request sent by the client, the efficiency of sending the request from the client to the server can be improved, so as to further improve the request response efficiency.
To facilitate understanding of a request method provided in the embodiment of the present application, a method for determining whether a preset data processing condition is currently satisfied provided in the embodiment of the present application is described in detail, and specifically refer to fig. 5.
As shown in fig. 5, the method includes:
s501, generating a random factor;
s502, judging whether the random factors meet preset data processing conditions or not; if the random factor satisfies the data processing condition, executing step S503; if the random factor does not satisfy the data processing condition, executing step S504;
in this embodiment of the present application, preferably, the determining whether the random factor satisfies a preset data processing condition includes: judging whether the random factor exceeds a preset random factor threshold value or not; if the random factor exceeds the random factor threshold, determining that the random factor meets the preset data processing condition; and if the random factor does not exceed the random factor threshold, determining that the random factor does not meet the preset data processing condition.
As a preferred implementation manner of the embodiment of the present application, the random factor may be any random number within a preset numerical range, and the random factor threshold may be a numerical value within the numerical range. For example, the random factor may be a random number between 0 and 100, and the random factor threshold may be 50; when the random factor exceeds 50, determining that the random factor meets the preset data processing condition; when the random factor does not exceed 50, it is determined that the random factor does not satisfy the preset data processing condition.
S503, determining that the current data processing conditions are met;
s504, determining that the data processing condition is not met currently.
According to the request method provided by the embodiment of the application, the server receives the request sent by the client, and under the condition that the historical request result of the request is stored in the cache of the server, if the historical request result does not meet the data processing condition at present, the historical request result is directly returned to the client, so that the request response efficiency is improved; and if the current data processing condition is met, performing data processing on the request to obtain a request result of the request, so as to verify the accuracy of the historical request result based on the request result, and further ensure the accuracy of the request result returned to the client. Therefore, the purpose of improving the request response efficiency can be achieved on the premise of considering the accuracy of the request result.
Fig. 6 is a schematic structural diagram of a requesting device according to an embodiment of the present disclosure.
As shown in fig. 6, the apparatus includes:
a history request result detecting unit 61, configured to detect whether a history request result of a request exists in a cache of a server when receiving a request sent by a client;
a first execution unit 62, configured to execute a first operation according to a history request result if it is detected that a history request result of the request exists in the server cache;
the second execution unit 63 is configured to, if it is detected that there is no history request result of the request in the server cache, process the request to obtain a request result, and execute a second operation using the request result.
In the embodiment of the present application, preferably, the first executing unit 62 includes:
the first judgment unit is used for judging whether preset data processing conditions are met currently;
the comparison unit is used for comparing the historical request result with the request result obtained by processing the request to obtain a comparison result and executing the operation matched with the comparison result if the data processing condition is met currently;
and the first returning unit is used for returning a history request result to the client if the data processing condition is not met currently.
In the embodiment of the present application, preferably, the comparison unit includes:
the second returning unit is used for returning the request result to the client if the comparison result represents that the historical request result is different from the request result, updating the historical request result into the request result, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration;
and the third returning unit is used for returning the history request result to the client if the comparison result represents that the history request result is the same as the request result.
In the embodiment of the present application, preferably, the second executing unit 63 includes:
and the fourth returning unit is used for returning the request result to the client, storing the request result to the server cache, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches the first preset duration.
In this embodiment, preferably, the client includes a request sending unit, and the request sending unit includes:
the IP address detection unit is used for detecting whether a first service end IP address used for receiving a request sent by a client is stored in a client cache or not when the request to be sent exists;
the domain name resolution unit is used for performing domain name resolution to obtain a second server IP address if the first server IP address is not stored in the client cache, sending a request to a server indicated by the second server IP address, and storing the second server IP address into the client cache;
and the request sending subunit is used for sending a request to the server indicated by the first service end IP address if the first service end IP address is stored in the client cache.
Further, the request method provided by the embodiment of the present application further includes a deleting unit, configured to delete the second server IP address from the client cache if a storage duration of the second server IP address in the client cache reaches a second preset duration.
In the embodiment of the present application, preferably, the condition determining unit includes:
a random factor generation unit for generating a random factor;
the condition judging subunit is used for judging whether the random factors meet the preset data processing conditions or not;
a first determining unit, configured to determine that the data processing condition is currently satisfied if the random factor satisfies the data processing condition;
and a second determining unit for determining that the data processing condition is not currently satisfied if the random factor does not satisfy the data processing condition.
In this embodiment of the present application, preferably, the condition determining subunit is specifically configured to determine whether the random factor exceeds a preset random factor threshold; if the random factor exceeds the random factor threshold, determining that the random factor meets the preset data processing condition; and if the random factor does not exceed the random factor threshold, determining that the random factor does not meet the preset data processing condition.
The following describes in detail a hardware structure of a server to which the request method provided in the embodiment of the present application is applied, by taking the case where the request method is applied to the server as an example.
The request method provided by the embodiment of the application can be applied to a server, and the server can be a service device which provides service for a user on a network side, can be a server cluster formed by a plurality of servers, and can also be a single server.
Optionally, fig. 7 shows a block diagram of a hardware structure of a server to which the request method provided in the embodiment of the present application is applied, and referring to fig. 7, the hardware structure of the server may include: a processor 71, a communication interface 72, a memory 73 and a communication bus 74;
in the embodiment of the present invention, the number of the processor 71, the communication interface 72, the memory 73, and the communication bus 74 may be at least one, and the processor 71, the communication interface 72, and the memory 73 complete communication with each other through the communication bus 74;
processor 71 may be a central processing unit CPU, or an Application Specific Integrated Circuit ASIC (Application Specific Integrated Circuit), or one or more Integrated circuits configured to implement embodiments of the present invention, or the like;
the memory 73 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory) or the like, such as at least one disk memory;
wherein the memory stores a program, the processor may invoke the program stored in the memory, and the program is operable to:
when a request sent by a client is received, detecting whether a historical request result of the request exists in a cache of a server;
if the history request result of the request in the cache of the server side is detected, executing a first operation according to the history request result;
and if the historical request result of the request does not exist in the cache of the server side, processing the request to obtain a request result, and executing a second operation by using the request result.
The functions of the program can be referred to the detailed description of one of the request methods provided in the embodiments of the present application, which is not repeated herein.
Further, an embodiment of the present application also provides a computer-readable computer storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are used for executing the above request method.
For details of the computer executable instructions, reference may be made to the above detailed description of a request method provided in the embodiments of the present application, which is not repeated herein.
According to the request method, the request device, the server, the system and the storage medium, when the server receives a request sent by a client, whether a historical request result of the request exists in a cache of the server is detected; if the fact that a historical request result of the request exists in the server cache is detected, a first operation is executed according to the historical request result; and if the historical request result of the request does not exist in the cache of the server side, processing the request to obtain the request result, and executing a second operation by using the request result. According to the method and the device, under the condition that the historical request result of the request is stored in the server cache, the request can not be processed, and corresponding operation is directly executed based on the historical request result, so that the purpose of improving the request response efficiency can be achieved on the premise of considering the accuracy of the request result.
In this document, 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 phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
In the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (7)

1. A method of requesting, comprising:
when a request sent by a client is received, detecting whether a historical request result of the request exists in a cache of a server;
if the historical request result of the request exists in the cache of the server side, executing a first operation according to the historical request result;
if the historical request result of the request does not exist in the cache of the server side, processing the request to obtain a request result, and executing a second operation by using the request result;
the executing of the first operation according to the history request result comprises:
judging whether preset data processing conditions are met or not at present;
if the data processing condition is met currently, responding to the request to perform data processing on the request to obtain a request result of the request, comparing the historical request result with the request result obtained by processing the request to obtain a comparison result, and executing operation matched with the comparison result;
if the data processing condition is not met currently, returning the history request result to the client;
the performing the operation matched with the comparison result comprises:
if the comparison result represents that the historical request result is different from the request result, returning the request result to the client, updating the historical request result into the request result, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration;
if the comparison result represents that the historical request result is the same as the request result, the historical request result is returned to the client;
the performing a second operation with the request result includes: returning the request result to the client, storing the request result to the server cache, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration;
the judging whether the current data processing condition is met includes:
generating a random factor;
judging whether the random factor exceeds a preset random factor threshold value;
if the random factor exceeds the random factor threshold, determining that the random factor meets the preset data processing condition;
if the random factor does not exceed the random factor threshold, determining that the random factor does not meet preset data processing conditions;
if the random factor meets the data processing condition, determining that the data processing condition is met currently;
and if the random factor does not meet the data processing condition, determining that the data processing condition is not met currently.
2. The method of claim 1, wherein the process of the client sending the request comprises:
when a request to be sent exists in the client, detecting whether a first service end IP address used for receiving the request sent by the client is stored in a client cache;
if the first server IP address is not stored in the client cache, performing domain name resolution to obtain a second server IP address, sending the request to a server indicated by the second server IP address, and storing the second server IP address in the client cache;
and if the first service end IP address is stored in the client cache, sending the request to a service end indicated by the first service end IP address.
3. The method of claim 2, further comprising:
and if the storage time of the second server IP address in the client cache reaches a second preset time, deleting the second server IP address from the client cache.
4. A requesting device, comprising:
the historical request result detection unit is used for detecting whether the historical request result of the request exists in the cache of the server or not when receiving the request sent by the client;
the first execution unit is used for executing a first operation according to a history request result if the history request result of the request is detected to exist in the cache of the server;
the second execution unit is used for processing the request to obtain a request result and executing a second operation by using the request result if the fact that the historical request result of the request does not exist in the cache of the server side is detected;
the first execution unit executes a first operation according to the history request result, and the first operation comprises the following steps:
judging whether preset data processing conditions are met or not at present;
if the data processing condition is met currently, responding to the request to perform data processing on the request to obtain a request result of the request, comparing the historical request result with the request result obtained by processing the request to obtain a comparison result, and executing an operation matched with the comparison result;
if the data processing condition is not met currently, returning the history request result to the client;
the performing the operation matched with the comparison result comprises:
if the comparison result represents that the historical request result is different from the request result, returning the request result to the client, updating the historical request result into the request result, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration;
if the comparison result represents that the historical request result is the same as the request result, the historical request result is returned to the client;
the performing a second operation with the request result includes: returning the request result to the client, storing the request result to the server cache, and deleting the request result from the server cache when the storage duration of the request result in the server cache reaches a first preset duration;
the judging whether the current data processing condition is met includes:
generating a random factor;
judging whether the random factor exceeds a preset random factor threshold value or not;
if the random factor exceeds the random factor threshold, determining that the random factor meets the preset data processing condition;
if the random factor does not exceed the random factor threshold, determining that the random factor does not meet preset data processing conditions;
if the random factor meets the data processing condition, determining that the data processing condition is currently met;
and if the random factor does not meet the data processing condition, determining that the data processing condition is not met currently.
5. A request server characterized by at least one memory and at least one processor; the memory stores a program that the processor calls, the processor calls the program stored in the memory, the program is used for realizing the request method of any one of claims 1 to 3.
6. A request system, comprising: a client according to any one of the preceding claims 1 to 3, and a request server according to claim 5.
7. A computer-readable storage medium having computer-executable instructions stored thereon for performing the method of requesting of any one of claims 1-3.
CN201911201314.7A 2019-11-29 2019-11-29 Request method, device, server, system and storage medium Active CN110891090B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911201314.7A CN110891090B (en) 2019-11-29 2019-11-29 Request method, device, server, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911201314.7A CN110891090B (en) 2019-11-29 2019-11-29 Request method, device, server, system and storage medium

Publications (2)

Publication Number Publication Date
CN110891090A CN110891090A (en) 2020-03-17
CN110891090B true CN110891090B (en) 2023-01-31

Family

ID=69749486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911201314.7A Active CN110891090B (en) 2019-11-29 2019-11-29 Request method, device, server, system and storage medium

Country Status (1)

Country Link
CN (1) CN110891090B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113114768A (en) * 2021-04-14 2021-07-13 北京京东振世信息技术有限公司 Service request processing method, device and system
CN114039963A (en) * 2021-11-08 2022-02-11 浙江岩华文化科技有限公司 Data transmission method, device, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101303700A (en) * 2008-06-13 2008-11-12 华为技术有限公司 Method and system for collecting web page
CN106874426A (en) * 2017-01-23 2017-06-20 福州大学 RDF stream data keyword real-time searching methods based on Storm
CN109033540A (en) * 2018-07-02 2018-12-18 郑州云海信息技术有限公司 A kind of incentive management method and system during chip accidental validation
CN110351133A (en) * 2019-06-28 2019-10-18 阿里巴巴集团控股有限公司 Method and device for the host node hand-off process in block catenary system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101303700A (en) * 2008-06-13 2008-11-12 华为技术有限公司 Method and system for collecting web page
CN106874426A (en) * 2017-01-23 2017-06-20 福州大学 RDF stream data keyword real-time searching methods based on Storm
CN109033540A (en) * 2018-07-02 2018-12-18 郑州云海信息技术有限公司 A kind of incentive management method and system during chip accidental validation
CN110351133A (en) * 2019-06-28 2019-10-18 阿里巴巴集团控股有限公司 Method and device for the host node hand-off process in block catenary system

Also Published As

Publication number Publication date
CN110891090A (en) 2020-03-17

Similar Documents

Publication Publication Date Title
CN108647240B (en) Method and device for counting access amount, electronic equipment and storage medium
CN110891090B (en) Request method, device, server, system and storage medium
CN110519409B (en) Domain name dynamic configuration method, device, equipment and storage medium
CN110851290A (en) Data synchronization method and device, electronic equipment and storage medium
CN106888277B (en) Domain name query method and device
CN115004673A (en) Message pushing method and device, electronic equipment and computer readable medium
CN111522836B (en) Data query method and device, electronic equipment and storage medium
CN112134960B (en) Data request method and device
CN110727892A (en) Cache data updating method and device and electronic equipment
CN111507714B (en) Verification method, verification device, server and storage medium
CN104168294A (en) Instant communication method, system and device across users on open platforms
CN113315852B (en) Domain name resolution method, device and system
CN112866062B (en) Distributed pressure test system, method, device, equipment and storage medium
EP2760178B1 (en) Method, apparatus and system for obtaining object
CN111049945A (en) Network request optimization method, device, equipment and medium based on HTTP (hyper text transport protocol)
CN111162952A (en) Equipment fault tolerance method and device
CN111242621A (en) Transaction data storage method, device, equipment and storage medium
JP6368127B2 (en) Communication device, control method, and program
CN111104376B (en) Resource file query method and device
CN109995855B (en) Data acquisition method, device and terminal
CN110851258B (en) API calling method, API calling device, computer equipment and storage medium
CN113452803B (en) Verification method, verification device, server and storage medium
CN113746868B (en) Method, device, equipment and medium for optimizing server performance
CN107835225B (en) Method, device and equipment for acquiring data information
CN111092966B (en) Domain name system, domain name access method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant