CN113065054B - Request processing method, request processing device, electronic equipment and storage medium - Google Patents

Request processing method, request processing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113065054B
CN113065054B CN202110352443.7A CN202110352443A CN113065054B CN 113065054 B CN113065054 B CN 113065054B CN 202110352443 A CN202110352443 A CN 202110352443A CN 113065054 B CN113065054 B CN 113065054B
Authority
CN
China
Prior art keywords
request
processing
identifier
client
slow query
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
CN202110352443.7A
Other languages
Chinese (zh)
Other versions
CN113065054A (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 Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110352443.7A priority Critical patent/CN113065054B/en
Publication of CN113065054A publication Critical patent/CN113065054A/en
Application granted granted Critical
Publication of CN113065054B publication Critical patent/CN113065054B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines

Abstract

The disclosure relates to a request processing method, a request processing device, electronic equipment and a storage medium. The method comprises the following steps: receiving a slow query request sent by a client, wherein the slow query request carries a request identifier; the request identification and the information required by processing the slow query request are sent to a target service in a mode of supporting asynchronous processing, and the target service is used for processing the slow query request and marking the request identification as successful processing after successful processing; and returning the processing result corresponding to the request identifier in the processing success state to the client. According to the scheme of the disclosure, by providing a general slow query request processing standard, different service ends can deploy a slow query request processing mode according to the standard, so that development cost of the slow query request processing mode is greatly reduced, and repeated design is avoided.

Description

Request processing method, request processing device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technology, and in particular, to a request processing method, apparatus, electronic device, computer readable storage medium, and computer program product.
Background
With the development of internet technology, there are often interfaces at the service end for processing a request (called a slow query request) that is relatively time consuming, for example, for processing a particularly complex request for an arithmetic requirement result sent by the client. Such interfaces often take time to process slow query requests, which may be on the order of tens of seconds or minutes, due to complex downstream logic, large computational effort, large data volume, and the like.
In the related art, each service end can set the processing mode of the slow query request according to the service characteristics, for example, the processing mode same as the common interface is adopted, and the number of servers is increased. However, with the rapid development of services, there is a problem that the development cost is high by adopting the above method.
Disclosure of Invention
The present disclosure provides a request processing method, apparatus, electronic device, computer readable storage medium, and computer program product, to at least solve the problem in the related art that the development cost is high when processing a slow query request. The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a request processing method, including:
receiving a slow query request sent by a client, wherein the slow query request carries a request identifier;
the request identification and the information required by processing the slow query request are sent to a target service in a mode of supporting asynchronous processing, and the target service is used for processing the slow query request and marking the request identification as successful processing after successful processing;
and returning the processing result corresponding to the request identifier in the processing success state to the client.
In one embodiment, the returning, to the client, the processing result corresponding to the request identifier in the processing success state includes:
responding to a result acquisition request sent by the client, and inquiring a state corresponding to the request identifier;
and returning the processing result to the client when the state corresponding to the request identifier is obtained by inquiry as the processing success.
In one embodiment, the result acquisition request is a request sent periodically by the client.
In one embodiment, the method further comprises:
when the state corresponding to the request identifier is obtained by inquiry and is in the process of starting processing, then
And continuously inquiring the state corresponding to the request identifier until a preset stopping condition is reached, wherein the state to start processing is marked after the request processing server receives the slow inquiry request, and the state in processing is marked after the target service receives the request identifier and information required by processing the slow inquiry request.
In one embodiment, the preset stopping condition includes at least one of a state corresponding to the request identifier being a processing success state, a state corresponding to the request identifier being a processing failure state, a number of times of inquiry reaching a preset number of times, and a state corresponding to the request identifier being not found.
In one embodiment, when the condition that the continuous query reaches the preset stop condition is that the state corresponding to the request identifier is any one of the processing failure, the number of times of query reaches the preset number of times, and the state of the request identifier is not queried, a processing failure notification is returned to the client.
In one embodiment, before the information required for identifying and processing the slow query request is sent to the target service in a manner supporting asynchronous processing, the method further includes:
writing the request identification into a pre-configured cache corresponding to the current service, and marking the request identification in the cache as starting processing.
In one embodiment, the method further comprises:
acquiring a preset storage format corresponding to the current service, and converting the format of information required by processing the slow query request into the storage format;
the sending the request identification and the information required for processing the slow query request to a target service in a manner supporting asynchronous processing comprises the following steps:
and sending the request identification and the information in the storage format to the target service in a mode of supporting asynchronous processing.
According to a second aspect of the embodiments of the present disclosure, there is provided a request processing apparatus, including:
the receiving module is configured to execute a slow query request sent by the receiving client, wherein the slow query request carries a request identifier;
the first sending module is configured to send the request identification and information required by processing the slow query request to a target service in a mode of supporting asynchronous processing, wherein the target service is used for processing the slow query request and marking the request identification as successful processing after successful processing;
and the second sending module is configured to execute the return of the processing result corresponding to the request identifier in the processing success state to the client.
In one embodiment, the second transmitting module includes:
the inquiring unit is configured to execute an acquisition request responding to the result sent by the client and inquire the state corresponding to the request identifier;
and the first sending unit is configured to execute the process result to be returned to the client when the state corresponding to the request identifier is obtained by query as the process success.
In one embodiment, the result acquisition request is a request sent periodically by the client.
In one embodiment, the query unit is further configured to execute, when the state corresponding to the request identifier obtained by the query is a start process or in process, continue to query the state corresponding to the request identifier until a preset stop condition is reached, where the state of the start process is marked after the request processing server receives the slow query request, and the state of the process is marked after the target service receives the request identifier and information required for processing the slow query request.
In one embodiment, the preset stopping condition includes at least one of a state corresponding to the request identifier being a processing success state, a state corresponding to the request identifier being a processing failure state, a number of times of inquiry reaching a preset number of times, and a state corresponding to the request identifier being not found.
In one embodiment, the apparatus further comprises: and the third sending module is configured to execute a processing failure notification to the client when the state corresponding to the request identifier when the continuous query reaches the preset stopping condition is any one of the processing failure, the query times reach the preset times and the state of the request identifier is not queried.
In one embodiment, the apparatus further comprises:
and the marking module is configured to perform writing of the request identification into a pre-configured cache corresponding to the current service, and identify the request in the cache as starting processing.
In one embodiment, the apparatus further comprises:
the acquisition module is configured to acquire a preset storage format corresponding to the current service, and convert the format of information required for processing the slow query request into the storage format;
the first sending module is configured to send the request identifier and the information in the storage format to the target service in a manner supporting asynchronous processing.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the request processing method according to any of the first aspects above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the request processing method as set forth in any one of the first aspects above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the request processing method of any one of the above-mentioned first aspects.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
after receiving the slow query request sent by the client through the interface, the request processing server sends the request identification and the information required by processing the slow query request to the target service in a mode of supporting asynchronous processing. The target service processes the slow query request, marks the request mark as successful after the processing is successful, so that the request processing server returns a processing result corresponding to the request mark in a processing success state to the client, thereby reducing the resource consumption of the request processing server and improving the interface performance and the QPS (query per second) upper limit of the request processing server. And by providing a general slow query request processing standard, different service ends can deploy the processing mode of the slow query request according to the standard, thereby greatly reducing the development cost of the processing mode of the slow query request and avoiding repeated design.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
FIG. 1 is an application environment diagram illustrating a request processing method according to an example embodiment.
FIG. 2 is a flow chart illustrating a method of request processing according to an exemplary embodiment.
FIG. 3 is a flowchart illustrating a method of request processing according to an exemplary embodiment.
Fig. 4 is a block diagram illustrating a request processing apparatus according to an example embodiment.
Fig. 5 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
The request processing method provided by the disclosure can be applied to an application environment as shown in fig. 1. Wherein the terminal 110 interacts with the request processing server 120 through a network. The request processing server 120 interacts with the service server 130 through a network. The terminal 110 has installed therein an application program, which may be a social type application program, an instant messaging type application program, a short video type application program, or the like. There may be a plurality of service servers 130, each service server 130 being configured to handle tasks under a corresponding service. Services may be used to characterize requirements and scenarios in applications, such as e-commerce, short video, customer service, etc. services included in applications. Processing logic for slow query requests is deployed in the request processing server 120. After the request processing server 120 receives the slow query request sent by the terminal 110 through the pre-designated interface, the request identifier and the information required for processing the slow query request are sent to the corresponding service server 130 in a manner of supporting asynchronous processing. The service server 130 processes the slow query request and marks the request identification as successful after the processing is successful. The request processing server 120 acquires the state corresponding to the request identifier, acquires the processing result corresponding to the request identifier after acquiring that the state corresponding to the request identifier has been changed to be processed successfully, and returns the processing result to the terminal 110.
Among them, the terminal 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The request processing server 120 and the service server 130 may be implemented as separate servers or as a server cluster composed of a plurality of servers.
Fig. 2 is a flowchart illustrating a request processing method, as shown in fig. 2, for use in a request processing server according to an exemplary embodiment, including the following steps.
In step S210, a slow query request sent by the client is received, where the slow query request carries a request identifier.
A slow query request may refer to a request that requires more time to process, e.g., a request on the order of seconds, tens of seconds, or even minutes. An interface for receiving a slow query request may be defined in advance from an interface dimension such that a request processing server regards a request received through the interface as a slow query request. The request identification is used for uniquely distinguishing the slow query request, and an association relationship is established between the slow query request and data related to the slow query request. The request identification may be characterized using specified information, such as a user identification, an identification of an object to be requested (e.g., video, image, etc.), a terminal identification, etc.; the request identification may also be a unique identification that the client generates before sending the request.
Specifically, after receiving the slow query request, the request processing server acquires a request identifier carried in the slow query request, and stores the request identifier in a database. The database may be a relational database, for example, adding the request identification to a pre-established table; the database may also be a non-relational database, stored in the form of key-value. The service end can specify the type of the database according to the actual requirement.
In step S220, the request identifier and information required for processing the slow query request are sent to the target service in a manner supporting asynchronous processing, and the target service is configured to process the slow query request, and mark the request identifier as successful after the processing is successful.
The target service refers to a service capable of being used for processing a slow query request. The target service may depend on the traffic to which the slow query request belongs. For example, the slow query request is a video query request, and then the target service may be a service pre-deployed by the video service end for processing the slow query request.
The information required to process the slow query request depends on the service to which the slow query request pertains and the specific content to which the slow query request refers. If the slow query request is a complex computational formula, the information required to process the slow query request may be the parameters in the formula; the slow query request is to query data in a data table with a larger data volume, and the information required for processing the slow query request may be index information required for querying the data.
Asynchronous processing is opposed to synchronous processing. When an asynchronous procedure call is issued, the caller (request processing server) cannot get the result immediately. After the callee (target service) finishes processing, the caller can be notified by means of status, notification, callback, and the like.
Specifically, after receiving the slow query request, the request processing server determines information required for processing the slow query request according to the service to which the slow query request belongs and the specific content pointed by the slow query request. The request processing server establishes an association relationship between the request identification and information required for processing the slow query request. The request processing server invokes a target service and sends the request identification and information required for processing the slow query request to the target service in a manner that supports asynchronous processing. The target service processes the slow query request based on the received information and marks the status of the request identification in the database as successful after the processing is successful.
In step S230, the processing result corresponding to the request identifier in the processing success state is returned to the client.
Specifically, the request processing server may query the database for the status of the request identification. And after the state change of the query request identifier is successful, obtaining a processing result obtained by processing the slow query request from the target service. And returning the processing result to the client side sending the slow query request.
In some possible embodiments, the request processing server may periodically or periodically query the database for the status of the request identifier until the status of the request identifier is queried to change to processing success. The timing may refer to a fixed point in time after sending the request identification and information to the target service. Periodicity may refer to querying every preset time period after sending the request identification and information to the target service.
In the above method, after receiving the slow query request sent by the client through the interface, the request processing server sends the request identifier and the information required for processing the slow query request to the target service in a manner of supporting asynchronous processing. The target service processes the slow query request, marks the request identifier as successful processing after the processing is successful, so that the request processing server returns a processing result corresponding to the request identifier in a successful processing state to the client, thereby reducing the resource consumption of the request processing server and improving the interface performance and the QPS upper limit of the request processing server. And by providing a general slow query request processing standard, different service ends can deploy the processing mode of the slow query request according to the standard, thereby greatly reducing the development cost of the processing mode of the slow query request and avoiding repeated design.
In an exemplary embodiment, in step S230, returning the processing result corresponding to the request identifier in the processing success state to the client includes: responding to a result acquisition request sent by a client, and inquiring a state corresponding to a request identifier; and when the state corresponding to the request identifier is obtained by inquiry and is successful in processing, returning a processing result corresponding to the request identifier to the client.
The result acquisition request is used for requesting a processing result generated after the slow query request is processed.
Specifically, after sending the slow query request, the client sends a result acquisition request to the request processing server. The request processing server queries the database for the current state of the request identification in response to the result acquisition request. If the current state is successful, the processing result is acquired from the target service, and the processing result is returned to the client for sending the result acquisition request.
In some possible embodiments, the client may send the result acquisition request to the request processing server periodically or periodically. The timing may refer to a fixed point in time after sending a slow query request to the request processing server. Periodicity may refer to querying every preset time period after sending a slow query request to a request processing server. The client can acquire the processing result in time by configuring the timing or periodically actively triggering the result acquisition request at the client, so that the waiting time of the user is reduced.
In some possible embodiments, if the target service fails to process a slow query request, the request identification may be marked as a processing failure after the processing failure. The request processing server responds to a result acquisition request sent by the client, and when the current state of the query request identifier is processing failure, a processing failure notification can be returned to the client.
In this embodiment, by splitting the request of the client into the slow query request and the result acquisition request, the request processing server performs the state of the query request identifier on the premise of receiving the result acquisition request, and returns the processing result corresponding to the request identifier in the processing success state to the client, the problem of performance degradation caused by excessive connection numbers between the client and the request processing server can be solved, and the resource occupation situation of the request processing server is reduced.
In an exemplary embodiment, the method further comprises: and when the state corresponding to the query obtaining request identifier is the starting process or the processing process, continuing to query the state corresponding to the request identifier until the preset stopping condition is reached.
Specifically, the request processing server receives the slow query request and marks the request identification as starting processing after storing the request identification in the database. After receiving the request identification and the information required for processing the slow query request, the target service changes the state of the request identification in the database into processing. The request processing server responds to a result acquisition request sent by the client and inquires the current state of the request identification from the database. If the current state is the starting process or in the process, the method continues to wait for the result acquisition request sent by the next client, or automatically continues to periodically inquire the state corresponding to the request identifier until the preset stop condition is reached.
The preset stop condition may be at least one of a state corresponding to the request identifier being a processing success, a state corresponding to the request identifier being a processing failure, the number of times of inquiry reaching a preset number of times, and a state corresponding to the request identifier being not inquired. The number of queries may be the total number of queries requesting the processing server, or the total number of queries to be continued, as the case may be. When the request processing server inquires that the state change corresponding to the request identification is successful, a processing result obtained by processing the slow inquiry request is obtained, and the processing result is returned to the client. And when the request processing server inquires that the state change corresponding to the request identifier is processing failure, returning a processing failure notification to the client. When the request processing server queries that the state of the request identifier in the database is still in the process of starting processing or processing, but the number of times of query has reached a preset number of times, for example, 6 times in advance, the request processing server records 1 once each time the request processing server queries, stops querying when the number of times of query reaches 6, and the request processing server returns a processing failure notification to the client. When the request processing server can not inquire the state corresponding to the request identification, the request processing server returns a processing failure notification to the client. General purpose medicine
Further, the preset stopping condition may be a preset duration, for example, preset inquiry for 5 seconds, and request the processing server to record the inquired duration, and stop inquiry when the inquired duration reaches 5 seconds.
In this embodiment, by configuring the query stopping condition at the request processing server, the request processing server is stopped to continue querying when the query stopping condition is satisfied, so that the running space of the request server is saved. And by setting the inquiry stopping condition, the situation that the waiting time of the client is too long can be avoided. By configuring at least one query stopping condition, various abnormal conditions in the slow query request can be met, and the stability of the slow query request processing process is improved. By subdividing the states of the request identifiers in the database, the request processing server can acquire corresponding results no matter whether the processing is successful or failed, so that the accuracy of the result return can be improved.
In an exemplary embodiment, before the information required for identifying and processing the slow query request is sent to the target service in a manner supporting asynchronous processing, step S220 further includes: and writing the request identification into a pre-configured cache corresponding to the current service, and identifying the request in the cache as starting processing.
Specifically, the service end may specify the corresponding buffer according to the actual requirement. After receiving the slow query request, the request processing server acquires a request identifier carried in the slow query request, stores the request identifier in a cache corresponding to the current service, and marks the request identifier in the cache as starting processing. Accordingly, after receiving the request identifier and the information required for processing the slow query request, the target service may mark the state of the request identifier in the cache according to the processing progress of the slow query request.
In this embodiment, by enabling different service ends to deploy caches of the slow query requests as required, and storing the request identifiers in the caches corresponding to the current service, the speed of marking and querying by the request processing server is facilitated to be increased, and further the processing efficiency of the slow query requests and the result query requests can be improved.
In an exemplary embodiment, before the information required for identifying and processing the slow query request is sent to the target service in a manner supporting asynchronous processing, step S220 further includes: and acquiring a preset storage format corresponding to the current service, and converting the format of information required for processing the slow query request into the storage format.
Specifically, different service ends may use different data storage formats, for example, proto (a data storage format), JSON (JavaScript Object Notation, JS object profile), and so on. After the request processing server receives the slow query request, a preset data storage format corresponding to the current service can be obtained. And converting the information required by processing the slow query request into the storage format, and further transmitting the request identification and the information in the storage format to the target service.
In this embodiment, by enabling different service ends to deploy the data storage format of the slow query request as required, compatibility of the processing mode of the slow query request at different service ends is improved, so that development cost of the processing mode of the slow query request is greatly reduced.
Fig. 3 is a flowchart illustrating a request processing method according to an exemplary embodiment, as shown in fig. 3, including the following steps.
In step S302, the request processing server receives a slow query request sent by the client, where the slow query request carries a request identifier.
In step S304, the request processing server writes the request identifier into a pre-configured cache corresponding to the current service, and marks the request identifier in the cache as starting processing.
In step S306, the request processing server acquires a preconfigured storage format corresponding to the current service, and converts the format of information required for processing the slow query request into the storage format.
In step S308, the request processing server transmits the request identifier and the format-converted information to the target service in a manner supporting asynchronous processing.
In step S310, the target service marks the request identifier in the cache as in-process after receiving the request identifier and the format-converted information.
In step S312, the target service processes the slow query request, and if the slow query request is successfully processed, the request identifier is marked as successful; if the processing of the slow query request fails, the request identification is marked as the processing failure.
In step S314, after the client transmits the slow query request to the request processing server, the client transmits the result query request to the request processing server at regular time.
In step S316, the request processing server queries the cache for the current state corresponding to the request identifier in response to the result acquisition request. If the current state is the start processing or in processing, step S318 is continued.
In step S318, the request processing server continues to query the state corresponding to the request identifier until: inquiring that the state change corresponding to the request identifier is successful in processing, and sending a processing result to the client; or, if the state change corresponding to the query obtained request identifier is a processing failure, returning a processing failure notification to the client; or, if the query times reach the preset times, returning a processing failure notification to the client; or if the state corresponding to the request identifier is not queried, returning a processing failure notification to the client.
In this embodiment, by splitting the request of the client into the slow query request and the result acquisition request, the request processing server performs the state of the query request identifier on the premise of receiving the result acquisition request, and returns the processing result corresponding to the request identifier in the processing success state to the client, the problem of performance degradation caused by excessive connection numbers between the client and the request processing server can be solved, and the resource occupation situation of the request processing server is reduced. And by providing a general slow query request processing standard, different service ends can deploy the processing mode of the slow query request according to the standard, thereby greatly reducing the development cost of the processing mode of the slow query request and avoiding repeated design.
It should be understood that, although the steps in the flowcharts described above are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described above may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a part of other steps or stages.
Fig. 4 is a block diagram illustrating a request processing apparatus 400 according to an example embodiment. Referring to fig. 4, the apparatus includes a receiving module 402, a first transmitting module 404, and a second transmitting module 406.
A receiving module 402, configured to execute a slow query request sent by a receiving client, where the slow query request carries a request identifier; a first sending module 404 configured to send the request identifier and information required for processing the slow query request to a target service in a manner of supporting asynchronous processing, where the target service is configured to process the slow query request, and mark the request identifier as successful after the processing is successful; the second sending module 406 is configured to perform returning, to the client, a processing result corresponding to the request identifier in the processing success state.
In an exemplary embodiment, the second transmitting module 406 includes: the query unit is configured to execute a result acquisition request sent by the client, and the query request identifies a corresponding state; and the first sending unit is configured to execute the process result returned to the client when the state corresponding to the query obtained request identifier is the process success.
In an exemplary embodiment, the result acquisition request is a request sent periodically by the client.
In an exemplary embodiment, the query unit is further configured to execute, when the state corresponding to the query obtaining request identifier is a start process or in process, continuing to query the state corresponding to the request identifier until a preset stop condition is reached, where the state of the start process is marked after the request processing server receives the slow query request, and the state in process is marked after the target service receives the request identifier and information required for processing the slow query request.
In an exemplary embodiment, the preset stop condition includes at least one of a state corresponding to the request identifier being a processing success, a state corresponding to the request identifier being a processing failure, the number of times of inquiry reaching a preset number of times, and a state corresponding to the request identifier being not inquired.
In an exemplary embodiment, the apparatus further comprises: and the third sending module is configured to execute the process failure notification to the client when the state corresponding to the request identifier is any one of the process failure, the number of times of inquiry reaches the preset number of times and the state of the request identifier is not inquired when the continuous inquiry reaches the preset stop condition.
In an exemplary embodiment, the apparatus 400 further comprises: and the marking module is configured to perform writing of the request identification into a pre-configured cache corresponding to the current service, and mark the request in the cache as starting processing.
In an exemplary embodiment, the apparatus 400 further comprises: the acquisition module is configured to acquire a preset storage format corresponding to the current service, and convert the format of information required for processing the slow query request into the storage format; a first sending module 402 configured to perform sending the request identification and the information in the storage format to the target service in a manner supporting asynchronous processing.
Fig. 5 is a block diagram of an electronic device S00 for processing slow query requests, according to an example embodiment. For example, electronic device S00 may be a server. Referring to fig. 5, electronic device S00 includes a processing component S20 that further includes one or more processors, and memory resources represented by memory S22, for storing instructions, such as applications, executable by processing component S20. The application program stored in the memory S22 may include one or more modules each corresponding to a set of instructions. Further, the processing component S20 is configured to execute instructions to perform the above-described request processing method.
Electronic device S00 can also include a power supply assembly S24 configured to perform power management of electronic device S00, a wired or wireless network interface S26 configured to connect electronic device S00 to a network, and an input output (I/O) interface S28. The electronic device S00 may operate based on an operating system stored in the memory S22, such as Windows Server, mac OS X, unix, linux, freeBSD, or the like.
In an exemplary embodiment, a computer readable storage medium comprising instructions, such as a memory S22 comprising instructions, is also provided, the instructions being executable by a processor of the electronic device S00 to perform the above-described method. The storage medium may be a computer readable storage medium, which may be, for example, ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
In an exemplary embodiment, a computer program product is also provided, comprising a computer program, which when executed by a processor implements the request processing method according to any of the above embodiments.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (18)

1. A request processing method, applied to a request processing server, the request processing server interacting with a client through a network, the method comprising:
receiving a slow query request sent by a client, wherein the slow query request carries a request identifier, and writing the request identifier into a preset cache corresponding to a current service, wherein the cache is designated by a service end to which the slow query request belongs;
the request identification and the information required by processing the slow query request are sent to a target service in a mode of supporting asynchronous processing, the target service is used for processing the slow query request and marking the request identification in the cache as successful processing after successful processing, and the target service is a service which is deployed in advance by the service end;
and inquiring the state of the request identifier in the cache, and returning a processing result corresponding to the request identifier in the processing success state to the client, wherein the processing result is obtained from the target service.
2. The method for processing a request according to claim 1, wherein said querying the state of the request identifier in the cache and returning the processing result corresponding to the request identifier in the processing success state to the client includes:
responding to a result acquisition request sent by the client, and inquiring a state corresponding to the request identifier;
and returning the processing result to the client when the state corresponding to the request identifier is obtained by inquiry as the processing success.
3. The request processing method according to claim 2, wherein the result acquisition request is a request periodically transmitted by the client.
4. The request processing method according to claim 2, characterized in that the method further comprises:
when the state corresponding to the request identifier is obtained by inquiry and is in the process of starting processing, then
And continuously inquiring the state corresponding to the request identifier until a preset stopping condition is reached, wherein the state to start processing is marked after the request processing server receives the slow inquiry request, and the state in processing is marked after the target service receives the request identifier and information required by processing the slow inquiry request.
5. The method according to claim 4, wherein the preset stop condition includes at least one of a successful processing of the state corresponding to the request identifier, a failed processing of the state corresponding to the request identifier, a preset number of times of inquiry, and a failure to inquire of the state corresponding to the request identifier.
6. The request processing method according to claim 4, characterized in that the method further comprises:
and when the continuous inquiry reaches any one of the states that the preset stopping condition is that the state corresponding to the request identifier is the processing failure, the inquiry times reach the preset times and the inquiry cannot reach the request identifier, returning a processing failure notification to the client.
7. The method of claim 1, wherein before sending the request identification and information needed to process the slow query request to a target service in a manner that supports asynchronous processing, further comprising:
the request identification in the cache is marked as a start of processing.
8. The request processing method according to claim 1, characterized in that the method further comprises:
acquiring a preset storage format corresponding to the current service, and converting the format of information required by processing the slow query request into the storage format;
the sending the request identification and the information required for processing the slow query request to a target service in a manner supporting asynchronous processing comprises the following steps:
and sending the request identification and the information in the storage format to the target service in a mode of supporting asynchronous processing.
9. A request processing apparatus, applied to a request processing server that interacts with a client through a network, comprising:
the receiving module is configured to execute a slow query request sent by a receiving client, wherein the slow query request carries a request identifier, the request identifier is written into a preset cache corresponding to a current service, and the cache is a cache designated by a service end to which the slow query request belongs;
the first sending module is configured to send the request identifier and information required by processing the slow query request to a target service in a mode of supporting asynchronous processing, wherein the target service is used for processing the slow query request and marking the request identifier in the cache as successful processing after successful processing, and the target service is a service pre-deployed by the service end;
and the second sending module is configured to perform query on the state of the request identifier in the cache, and return a processing result corresponding to the request identifier in the processing success state to the client, wherein the processing result is acquired from the target service.
10. The request processing apparatus of claim 9, wherein the second transmitting module comprises:
the inquiring unit is configured to execute an acquisition request responding to the result sent by the client and inquire the state corresponding to the request identifier;
and the first sending unit is configured to execute the process result to be returned to the client when the state corresponding to the request identifier is obtained by query as the process success.
11. The request processing apparatus according to claim 10, wherein the result acquisition request is a request periodically transmitted by the client.
12. The apparatus according to claim 10, wherein the query unit is further configured to perform, when the query results in that the state corresponding to the request identifier is a start process or in process, continuing to query the state corresponding to the request identifier until a preset stop condition is reached, the state of the start process being marked after the request processing server receives the slow query request, and the state of the process being marked after the target service receives the request identifier and information required for processing the slow query request.
13. The apparatus according to claim 12, wherein the preset stop condition includes at least one of a state corresponding to the request identifier being a processing success, a state corresponding to the request identifier being a processing failure, a number of times of inquiry reaching a preset number of times, and a state corresponding to the request identifier being not inquired.
14. The request processing apparatus of claim 12, wherein the apparatus further comprises:
and the third sending module is configured to execute a processing failure notification to the client when the state corresponding to the request identifier is any one of processing failure, the number of times of inquiry reaches the preset number of times and the state of the request identifier is not inquired when the continuous inquiry reaches the preset stop condition.
15. The request processing apparatus of claim 9, wherein the apparatus further comprises:
a tagging module configured to perform identifying the request in the cache as a start of processing.
16. The request processing apparatus of claim 9, wherein the apparatus further comprises:
the acquisition module is configured to acquire a preset storage format corresponding to the current service, and convert the format of information required for processing the slow query request into the storage format;
the first sending module is configured to send the request identifier and the information in the storage format to the target service in a manner supporting asynchronous processing.
17. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the request processing method of any one of claims 1 to 8.
18. A computer readable storage medium, characterized in that instructions in the computer readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the request processing method of any one of claims 1 to 8.
CN202110352443.7A 2021-03-31 2021-03-31 Request processing method, request processing device, electronic equipment and storage medium Active CN113065054B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110352443.7A CN113065054B (en) 2021-03-31 2021-03-31 Request processing method, request processing device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110352443.7A CN113065054B (en) 2021-03-31 2021-03-31 Request processing method, request processing device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113065054A CN113065054A (en) 2021-07-02
CN113065054B true CN113065054B (en) 2024-03-01

Family

ID=76565004

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110352443.7A Active CN113065054B (en) 2021-03-31 2021-03-31 Request processing method, request processing device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113065054B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113839953A (en) * 2021-09-27 2021-12-24 上海商汤科技开发有限公司 Labeling method and device, electronic equipment and storage medium
CN115604342B (en) * 2022-09-29 2024-04-16 重庆长安汽车股份有限公司 Data processing method, server, computer readable storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1794692A (en) * 2005-11-25 2006-06-28 华为技术有限公司 Communication system and method of inquiring information in communication system
CN104050250A (en) * 2011-12-31 2014-09-17 北京奇虎科技有限公司 Distributed key-value query method and query engine system
JP2016057869A (en) * 2014-09-10 2016-04-21 日本電気株式会社 Command execution system, client device, server device, and command execution method
CN106034113A (en) * 2015-03-12 2016-10-19 阿里巴巴集团控股有限公司 Data processing method and data processing device
CN106339440A (en) * 2016-08-22 2017-01-18 东软集团股份有限公司 Asynchronous task checking method and equipment
CN107040563A (en) * 2016-02-04 2017-08-11 阿里巴巴集团控股有限公司 Asynchronous service processing method and server
CN107545050A (en) * 2017-08-22 2018-01-05 阿里巴巴集团控股有限公司 Data query method and device, electronic equipment
CN107798108A (en) * 2017-10-30 2018-03-13 中国联合网络通信集团有限公司 A kind of asynchronous task querying method and equipment
CN108965380A (en) * 2018-05-31 2018-12-07 平安医疗科技有限公司 Service request processing method, device, computer equipment and storage medium
CN110795457A (en) * 2019-09-24 2020-02-14 苏宁云计算有限公司 Data caching processing method and device, computer equipment and storage medium
CN111176858A (en) * 2019-11-25 2020-05-19 腾讯云计算(北京)有限责任公司 Data request processing method and device
CN111367725A (en) * 2020-02-28 2020-07-03 平安养老保险股份有限公司 Asynchronous task online monitoring method, front-end control system and service response platform
CN111625323A (en) * 2019-02-28 2020-09-04 北京京东尚科信息技术有限公司 Distributed task processing method, device, equipment and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113037538B (en) * 2017-04-19 2022-11-25 华为技术有限公司 System and method for local scheduling of low-delay nodes in distributed resource management

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1794692A (en) * 2005-11-25 2006-06-28 华为技术有限公司 Communication system and method of inquiring information in communication system
CN104050250A (en) * 2011-12-31 2014-09-17 北京奇虎科技有限公司 Distributed key-value query method and query engine system
JP2016057869A (en) * 2014-09-10 2016-04-21 日本電気株式会社 Command execution system, client device, server device, and command execution method
CN106034113A (en) * 2015-03-12 2016-10-19 阿里巴巴集团控股有限公司 Data processing method and data processing device
CN107040563A (en) * 2016-02-04 2017-08-11 阿里巴巴集团控股有限公司 Asynchronous service processing method and server
CN106339440A (en) * 2016-08-22 2017-01-18 东软集团股份有限公司 Asynchronous task checking method and equipment
CN107545050A (en) * 2017-08-22 2018-01-05 阿里巴巴集团控股有限公司 Data query method and device, electronic equipment
CN107798108A (en) * 2017-10-30 2018-03-13 中国联合网络通信集团有限公司 A kind of asynchronous task querying method and equipment
CN108965380A (en) * 2018-05-31 2018-12-07 平安医疗科技有限公司 Service request processing method, device, computer equipment and storage medium
CN111625323A (en) * 2019-02-28 2020-09-04 北京京东尚科信息技术有限公司 Distributed task processing method, device, equipment and computer readable storage medium
CN110795457A (en) * 2019-09-24 2020-02-14 苏宁云计算有限公司 Data caching processing method and device, computer equipment and storage medium
CN111176858A (en) * 2019-11-25 2020-05-19 腾讯云计算(北京)有限责任公司 Data request processing method and device
CN111367725A (en) * 2020-02-28 2020-07-03 平安养老保险股份有限公司 Asynchronous task online monitoring method, front-end control system and service response platform

Also Published As

Publication number Publication date
CN113065054A (en) 2021-07-02

Similar Documents

Publication Publication Date Title
CN111464615B (en) Request processing method, device, server and storage medium
EP3489825A1 (en) Method, apparatus and computer readable storage medium for processing service
CN113065054B (en) Request processing method, request processing device, electronic equipment and storage medium
CN113450098A (en) Payment transaction processing method and device, storage medium and electronic equipment
CN110727523B (en) Service request processing method, service request processing device and readable storage medium
CN114553762A (en) Method and device for processing flow table items in flow table
CN112783618A (en) Task scheduling monitoring system, computer equipment and storage medium
CN112866339A (en) Data transmission method and device, computer equipment and storage medium
WO2023082681A1 (en) Data processing method and apparatus based on batch-stream integration, computer device, and medium
CN106899652B (en) Method and device for pushing service processing result
CN111831503A (en) Monitoring method based on monitoring agent and monitoring agent device
CN113590252B (en) Information pushing method and device, electronic equipment and storage medium
CN112328598B (en) ID generation method, ID generation device, electronic equipment and storage medium
CN109120692B (en) Method and apparatus for processing requests
CN111913789A (en) Program tracking method, device and medium supporting micro-service architecture
CN112948225A (en) Link monitoring method and device, monitoring equipment and storage medium
CN116010126B (en) Service aggregation method, device and system
CN114553806B (en) Optimization method, device and equipment for instant messaging and storage medium
CN112308431B (en) Big data index management method, device, equipment and storage medium
CN114884987B (en) Method, device and storage medium for acquiring equipment state information
CN115390834A (en) File generation method, device, equipment and storage medium
CN114884807A (en) Link log generation method and device, Internet of things platform and storage medium
CN115391632A (en) Data query system, method, device and computer equipment based on RestFul protocol
CN116627543A (en) Picture processing method, device, terminal equipment and storage medium
CN117971881A (en) Data query method, device, electronic equipment and storage medium

Legal Events

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