CN113296955A - Service request processing method and device, computer equipment and medium - Google Patents

Service request processing method and device, computer equipment and medium Download PDF

Info

Publication number
CN113296955A
CN113296955A CN202110654897.XA CN202110654897A CN113296955A CN 113296955 A CN113296955 A CN 113296955A CN 202110654897 A CN202110654897 A CN 202110654897A CN 113296955 A CN113296955 A CN 113296955A
Authority
CN
China
Prior art keywords
request
termination time
sub
service
time
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.)
Pending
Application number
CN202110654897.XA
Other languages
Chinese (zh)
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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110654897.XA priority Critical patent/CN113296955A/en
Publication of CN113296955A publication Critical patent/CN113296955A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5013Request control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5072Grid computing

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The disclosure provides a service request processing method, a service request processing device, computer equipment and a medium, and relates to the technical field of cloud computing, in particular to the technical field of micro-service. The implementation scheme is as follows: receiving a service request, wherein the service request comprises a termination time identifier used for indicating the termination time of the service; determining at least one sub-request to be distributed based on the service request; and for any sub-request in the at least one sub-request, determining a sub-termination time at which a processing task for the sub-request can be completed; and in response to determining that the child termination time exceeds the service termination time indicated by the termination time indicator, determining not to perform the distribution for the child request.

Description

Service request processing method and device, computer equipment and medium
Technical Field
The present disclosure relates to the field of cloud computing technologies, and in particular, to the field of micro service technologies, and in particular, to a method and an apparatus for processing a service request, a computer device, a computer-readable storage medium, and a computer program product.
Background
Cloud computing (cloud computing) refers to a technology architecture that accesses a flexibly extensible shared physical or virtual resource pool through a network, where resources may include servers, operating systems, networks, software, applications, storage devices, and the like, and may be deployed and managed in an on-demand, self-service manner. Through the cloud computing technology, high-efficiency and strong data processing capacity can be provided for technical application and model training of artificial intelligence, block chains and the like.
The approaches described in this section are not necessarily approaches that have been previously conceived or pursued. Unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section. Similarly, unless otherwise indicated, the problems mentioned in this section should not be considered as having been acknowledged in any prior art.
Disclosure of Invention
The present disclosure provides a service request processing method, apparatus, computer device, computer readable storage medium and computer program product.
According to an aspect of the present disclosure, there is provided a method for processing a service request, including: receiving a service request, wherein the service request comprises a termination time identifier used for indicating the termination time of the service; determining at least one sub-request to be distributed based on the service request; and for any sub-request in the at least one sub-request, determining a sub-termination time at which a processing task for the sub-request can be completed; and in response to determining that the child termination time exceeds the service termination time indicated by the termination time indicator, determining not to perform the distribution for the child request.
According to an aspect of the present disclosure, there is provided a service request processing apparatus, including: a receiving unit configured to receive a service request, wherein the service request includes a termination time identifier indicating a service termination time; a first determining unit configured to determine at least one sub-request to be distributed based on the service request; and a second determining unit configured to determine, for any one of the at least one sub-request, a sub-termination time at which a processing task for the sub-request can be completed; and in response to determining that the child termination time exceeds the service termination time indicated by the termination time indicator, determining not to perform the distribution for the child request.
According to an aspect of the present disclosure, there is provided a computing device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method described above.
According to an aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method according to the above.
According to an aspect of the disclosure, a computer program product is provided, comprising a computer program, wherein the computer program realizes the above-mentioned method when executed by a processor.
According to one or more embodiments of the disclosure, the distribution of the invalid sub-request to the downstream nodes can be terminated in advance before the service termination time, so that the invalid processing in the network service system is avoided, the processing resources are effectively saved, and the occurrence of service avalanche is prevented.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the embodiments and, together with the description, serve to explain the exemplary implementations of the embodiments. The illustrated embodiments are for purposes of illustration only and do not limit the scope of the claims. Throughout the drawings, identical reference numbers designate similar, but not necessarily identical, elements.
FIG. 1 illustrates an exemplary network services system diagram;
FIG. 2 illustrates a schematic diagram of an exemplary system in which various methods described herein may be implemented, according to an embodiment of the present disclosure;
FIG. 3 shows a flow diagram of a method of processing a service request according to an embodiment of the present disclosure;
FIG. 4 shows a time transition diagram in accordance with an embodiment of the present disclosure;
fig. 5 shows a block diagram of a service request processing apparatus according to an embodiment of the present disclosure;
FIG. 6 shows a block diagram of an exemplary computer device, according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, the timing relationship, or the importance relationship of the elements, and such terms are used only to distinguish one element from another. In some examples, a first element and a second element may refer to the same instance of the element, and in some cases, based on the context, they may also refer to different instances.
The terminology used in the description of the various examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the elements may be one or more. Furthermore, the term "and/or" as used in this disclosure is intended to encompass any and all possible combinations of the listed items.
In order to cope with the increase of complexity of the network service, the system for executing the network service is split, and particularly with the rise of micro service technology, a network service system may have dozens or even hundreds of service nodes supported by one application, and a request of a front end may need multiple service node calls of multiple hierarchies to be completed. For example, fig. 1 is a schematic diagram of an exemplary network service system. After the network service system receives the service request, according to the type of the service request, determining a distribution strategy corresponding to the service request, so that at least one sub-request corresponding to the service request can be distributed among multiple levels of nodes in the system, and returning a final service result through the processing results of the multiple nodes.
In order to cope with the unstable situation of the network and the system in the network service process, a retry mechanism is introduced into the interaction between the front end and the network service system, namely, when the required service result cannot be returned to the front end, the resending of the service request is automatically triggered. However, when service requests from multiple front ends are continuously spread throughout the links of the network service system, it may cause immeasurable load pressure on the network service system, and even cause service avalanches to occur.
In the related art, in order to reduce the load pressure of the network service system, a timeout time is introduced into the interaction between the front end and the network service system to limit the access amount of service requests in the entire network service system by the constraint of a preset time range. For example, the timeout may be set to 300ms and the front end is specified to automatically terminate the data connection with the network service system 300ms after the front end issues the service request.
However, the timeout mechanism is only used to ensure that the network service system does not start a new service processing task after the timeout is reached, but the network service system cannot terminate processing of a service request that has been received before the timeout is reached. Even if the data connection between the front end and the network service system is disconnected during the processing of the service request, the processing result of the network service system cannot be returned to the front end, and the network service system will continue to execute the processing of the service request. With the increase of the complexity of the current network service and the refinement of the splitting of the network service, the above-mentioned invalid service requests are continuously distributed and processed among a large number of nodes in the network service system, thereby causing a huge waste of processing resources and still being unable to avoid the occurrence of service avalanches.
Based on this, the present disclosure provides a processing method, an apparatus, a computer device, a non-transitory computer-readable storage medium, and a computer program product for enabling a node receiving a service request to determine a service termination time by inserting a termination time flag indicating the service termination time in the service request, and further determining not to perform distribution for any of at least one sub-request determined based on the service request in response to determining that the sub-termination time at which a processing task for the sub-request can be completed exceeds the service termination time. Therefore, the distribution of the invalid sub-request can be terminated in advance before the service termination time, so that invalid processing in a network service system is avoided, processing resources are effectively saved, and service avalanche is prevented.
Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
Fig. 2 illustrates a schematic diagram of an exemplary system 200 in which various methods and apparatus described herein may be implemented, according to an embodiment of the present disclosure. Referring to fig. 2, the system 200 includes one or more client devices 201, 202, 203, 204, 205, and 206, a server 220, and one or more communication networks 210 coupling the one or more client devices to the server 220. The client devices 201, 202, 203, 204, 205, and 206 may be configured to execute one or more applications.
In an embodiment of the present disclosure, server 220 may run one or more services or software applications that enable the execution of the processing method of the service request.
In some embodiments, server 220 may also provide other services or software applications that may include non-virtual environments and virtual environments. In certain embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 201, 202, 203, 204, 205, and/or 206 under a software as a service (SaaS) model.
In the configuration shown in fig. 2, server 220 may include one or more components that implement the functions performed by server 220. These components may include software components, hardware components, or a combination thereof, which may be executed by one or more processors. A user operating a client device 201, 202, 203, 204, 205, and/or 206 may, in turn, utilize one or more client applications to interact with server 220 to take advantage of the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from system 200. Accordingly, fig. 2 is one example of a system for implementing the various methods described herein and is not intended to be limiting.
The user may use the client device 201, 202, 203, 204, 205, and/or 206 to generate and/or send a service request. The client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via the interface. Although fig. 2 depicts only six client devices, those skilled in the art will appreciate that any number of client devices may be supported by the present disclosure.
Client devices 201, 202, 203, 204, 205, and/or 206 may include various types of computer devices, such as portable handheld devices, general purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, gaming systems, thin clients, various messaging devices, sensors or other sensing devices, and so forth. These computer devices may run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux, or Linux-like operating systems (e.g., Google Chrome OS); or include various Mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular telephones, smart phones, tablets, Personal Digital Assistants (PDAs), and the like. Wearable devices may include head mounted displays and other devices. The gaming system may include a variety of handheld gaming devices, internet-enabled gaming devices, and the like. The client device is capable of executing a variety of different applications, such as various Internet-related applications, communication applications (e.g., email applications), Short Message Service (SMS) applications, and may use a variety of communication protocols.
Network 210 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP/IP, SNA, IPX, etc. By way of example only, one or more networks 210 may be a Local Area Network (LAN), an ethernet-based network, a token ring, a Wide Area Network (WAN), the internet, a virtual network, a Virtual Private Network (VPN), an intranet, an extranet, a Public Switched Telephone Network (PSTN), an infrared network, a wireless network (e.g., bluetooth, WIFI), and/or any combination of these and/or other networks.
Server 220 may include one or more general purpose computers, special purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-end servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and/or combination. Server 220 may include one or more virtual machines running a virtual operating system, or other computing architecture involving virtualization (e.g., one or more flexible pools of logical storage that may be virtualized to maintain virtual storage for the server). In various embodiments, server 220 may run one or more services or software applications that provide the functionality described below.
The computing units in server 220 may run one or more operating systems including any of the operating systems described above, as well as any commercially available server operating systems. Server 220 may also run any of a variety of additional server applications and/or middle tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, and the like.
In some implementations, the server 220 may include one or more applications to analyze and consolidate data feeds and/or event updates received from users of the client devices 201, 202, 203, 204, 205, and 206. Server 220 may also include one or more applications to display data feeds and/or real-time events via one or more display devices of client devices 201, 202, 203, 204, 205, and 206.
In some embodiments, server 220 may be a server of a distributed system, or a server that incorporates a blockchain. The server 220 may also be a cloud server, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology. The cloud Server is a host product in a cloud computing service system, and is used for solving the defects of high management difficulty and weak service expansibility in the traditional physical host and Virtual Private Server (VPS) service.
The system 200 may also include one or more databases 230. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 230 may be used to store information such as audio files and video files. Data store 230 may reside in various locations. For example, the data store used by server 220 may be local to server 220, or may be remote from server 220 and may communicate with server 220 via a network-based or dedicated connection. Data store 230 may be of different types. In certain embodiments, the data store used by server 220 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve data to and from the database in response to the command.
In some embodiments, one or more of databases 230 may also be used by applications to store application data. The databases used by the application may be different types of databases, such as key-value stores, object stores, or regular stores supported by a file system.
The system 200 of fig. 2 may be configured and operated in various ways to enable application of the various methods and apparatus described in accordance with the present disclosure.
Fig. 3 is a flowchart illustrating a method of processing a service request according to an exemplary embodiment of the present disclosure, which may include, as shown in fig. 3: step S301, receiving a service request, wherein the service request comprises a termination time identifier for indicating the termination time of the service; step S302, based on the service request, determining at least one sub-request to be distributed; step S303, aiming at any sub-request in at least one sub-request, determining the sub-termination time capable of completing the processing task aiming at the sub-request; and in response to determining that the child termination time exceeds the service termination time indicated by the termination time indicator, determining not to perform the distribution for the child request.
Based on the service request processing method, the invalid sub-request can be terminated to be distributed to the downstream in advance before the service termination time, so that invalid processing in a network service system is avoided, processing resources are effectively saved, and service avalanche is prevented.
With respect to step S301, a sending end of the service request may be a client of a front end, or may be one of nodes in the network service system. The receiver of the service request may be another node in the network service system that is communicatively coupled to the sender of the service request. The node may be a gateway, a service node formed by a server, or the like, and is not limited herein.
The service termination time represents the time when the front end and the network service system interrupt data connection. In one embodiment, the front end may determine the time at which the data connection to the network service system is interrupted based on a preset timeout. For example, when the timeout time is 300ms, the front end may start at the time of sending the service request to the network service system, and after 300ms, the front end may automatically interrupt the data connection with the network service system regardless of whether the network service system returns the service result.
It should be noted that the network service system often cannot sense the data connection state with the front end in real time, and only when the network service system reads or writes data to the front end and finds that the data reading or writing fails, the network service system can know that the data connection between the network service system and the front end has been disconnected. In this case, the perception of service termination by the network service system is delayed and the actual time of service termination, and even more, it is impossible to terminate the distribution of invalid service requests downstream in the network service system in time before service termination, resulting in the spread of invalid distribution and processing in the network service system and consuming processing resources.
In step S301, by inserting a termination time identifier for indicating a service termination time into the service request, the node receiving the service request can be made to sense the service termination time, and then determine a distribution policy for the sub-request based on the determined service termination time, so as to save processing resources in the system to the greatest extent.
According to some embodiments, the end time identifier may be a relative end time, which may represent a remaining time from the service termination time. The receiving end of the service request can accurately acquire the service termination time through the relative termination time.
In one embodiment, the relative expiration time may be a preset timeout time.
In another embodiment, the relative termination time may be determined based on a current time of a sending end of the service request and a service termination time, and specifically, the relative termination time is a time difference between the service termination time and the current time.
It is noted that clock asynchronism is often a problem in different machines. Therefore, if the service termination time is directly transmitted between different machines, the receiving end cannot accurately acquire the true service termination time due to the asynchronous clocks.
For example, the clock of the transmitting end indicates the current time of 14 o 'clock 28 min 46 sec, while the clock of the receiving end is 2 min faster than the clock of the transmitting end, i.e., the clock of the receiving end indicates the current time of 14 o' clock 30 min 46 sec. It is assumed that the service termination time determined at the transmitting end is 14 o' clock 28 min 51 sec and is transmitted to the receiving end by the service request. After receiving the service termination time (14: 28/51 seconds), the receiving end directly judges that the current time exceeds the service termination time of the service request based on the current time (14: 30/46 seconds) of the local clock of the receiving end, and terminates the downstream distribution of subsequent requests, so that the task processing of the service request cannot be normally executed.
Based on this, the relative termination time is transmitted between the sending end and the receiving end, so that the receiving end of the service request can accurately acquire the service termination time, and the judgment error of the receiving end caused by the inconsistency of clocks between the sending end and the receiving end is avoided.
According to some embodiments, the relative termination time may be converted into an absolute termination time before determining the at least one sub-request to be distributed based on the service request, wherein the absolute termination time may be a service termination time instant. By converting the relative termination time into the absolute termination time at the receiving end, the waiting error caused by the process that the service request waits for processing at the receiving end can be eliminated, and the accuracy of the service termination time determined by the receiving end is further improved.
In one embodiment, the conversion of the relative expiration time to the absolute expiration time may be performed by a proxy node deployed at the receiving end.
It should be noted that the service request received by the receiver may not be processed immediately due to overload of the receiver, and the like, and the service request needs to wait for a certain time in the queue, which cannot be calculated in advance. Therefore, if the receiving end determines the service termination time corresponding to the service request according to the relative termination time included in the service request after the service request is taken out from the waiting queue, the accuracy of the receiving end determination will be undoubtedly affected.
For example, the relative termination time included in the service request is 200ms, and after the receiving end receives the service request, the service request waits 50ms in the queue, that is, 50ms has elapsed when the service request is finished waiting, taken out from the queue and started to be processed. However, the receiving end cannot eliminate the waiting time of 50ms from the relative end time of 200ms, that is, the receiving end considers that the service request reaches the end time of the service after 200ms after being taken out from the queue, which causes a deviation in the judgment of the end time of the service by the receiving end.
Based on this, after the receiving end receives the service request, the relative termination time included in the service request is converted into the absolute termination time. Since the absolute termination time is not affected by the waiting time of the service request, the accuracy of the judgment of the service termination time by the receiving end can be ensured.
According to some embodiments, converting the relative end time to an absolute end time may comprise: determining the current time based on the local clock; and determining an absolute end time based on the current time and the relative end time. An absolute termination time indicating service termination can thus be determined based on the local clock, while errors due to clock asynchrony and latency between different machines are avoided.
For example, the relative end time included in the service request is 100ms, and after the receiving end receives the service request, the receiving end determines that the current time is 16 o ' clock 00 min 00 s based on the local clock of the receiving end, and then determines that the absolute end time is 16 o ' clock 00 min 01 s based on the current time (16 o ' clock 00 min) and the relative end time (100 ms). Subsequently, even if the service request waits for a certain time period in the wait queue of the receiving end, the receiving end can accurately judge the service termination time based on the determined absolute termination time (16: 00 min 01 sec).
According to some embodiments, the absolute expiration time may be represented in unix timestamps. Thereby enabling to conveniently express the absolute termination time.
Fig. 4 is a schematic diagram illustrating time transition according to an exemplary embodiment of the disclosure, and for convenience of explanation, a client is used as a sending end of a service request in fig. 4, and an entirety of a service node S and a proxy service node S 'in a network service system is used as a receiving end of the service request, where the service node S and the proxy service node S' share the same local clock.
As shown in fig. 4, the time transition in the data interaction between the client and the network service system may include the following steps:
step 401: the client sends a service request to a network service system, wherein the service request comprises relative termination time;
step 402: the method comprises the following steps that a proxy service node S' of a network service system receives a service request, extracts relative termination time from the service request, and converts the relative termination time into absolute termination time based on a local clock;
step 403: the proxy service node S' sends a service request to the service node S, wherein the service request comprises the converted absolute termination time;
step 404: the service request waits to be processed in a waiting queue of the service node S;
step 405: the service request ends waiting in the waiting queue, and the subsequent processing of the service request is performed by the service node S.
After receiving the service request, step S302 may be further performed, based on the service request, determining at least one sub-request to be distributed by the receiving end. And further by executing step S303, it is determined whether to execute distribution of the sub-request by comparing the sub-termination time at which the processing task for the sub-request can be completed with the service termination time.
According to some embodiments, determining a sub-termination time at which the processing task for the sub-request can be completed may include: a child termination time at which a processing task for the child request can be completed is determined based on a result of the preliminary offline test for the child request. The child termination time can be easily determined by a predetermined offline test result.
According to some embodiments, determining a sub-termination time at which the processing task for the sub-request can be completed may further include: the sub-termination time at which the processing task for the sub-request can be completed is determined based on the length of time taken to complete the processing task for the sub-request in the history time. The child termination time can be accurately determined by the time length taken to complete the processing task for the child request in the history time.
According to some embodiments, the service request processing method may further include: determining a distribution order of at least one sub-request to be distributed; and for any of the at least one sub-request, in response to determining not to perform distribution for the sub-request, determining not to perform distribution for sub-requests that are subsequent to the sub-request in the distribution order. Therefore, whether the subsequent sub-request distribution is executed or not can be further determined based on the judgment result of one sub-request in the at least one sub-request, and the processing efficiency is improved.
At least one sub-request to be distributed can have a certain distribution order, and after the processing task corresponding to the previous sub-request is finished and the processing result is returned, the next sub-request is distributed according to the distribution order, so that the processing result of one or more sub-requests with the distribution order before can be used in the process of processing the task of the sub-request with the distribution order after. In the process in which the receiving end sequentially distributes each sub-request in order, if it is determined that the distribution for any one sub-request is not performed, it can be judged that the sub-requests located after the sub-request in the distribution order have not been completed by the remaining time. Therefore, the distribution of subsequent sub-requests can be directly determined not to be executed without comparing the sub-termination time with the service termination time aiming at each sub-request, and the processing efficiency is effectively improved.
According to another aspect of the present disclosure, there is also provided a device 500 for processing a service request, the device 500 including: a receiving unit 501, configured to receive a service request, where the service request includes a termination time identifier for indicating a termination time of the service; a first determining unit 502 configured to determine at least one sub-request to be distributed based on the service request; and a second determining unit 503 configured to determine, for any one of the at least one sub-request, a sub-termination time at which a processing task for the sub-request can be completed; and in response to determining that the child termination time exceeds the service termination time indicated by the termination time indicator, determining not to perform the distribution for the child request.
According to some embodiments, the termination time is identified as a relative termination time, the relative termination time representing a remaining duration from a service termination time.
According to some embodiments, the apparatus further comprises: a third determining unit configured to convert the relative termination time into an absolute termination time before determining at least one sub-request to be distributed based on the service request, wherein the absolute termination time is a service termination time.
According to some embodiments, the third determining unit comprises: a module for determining a current time based on a local clock; and a module for determining an absolute end time based on the current time and the relative end time.
According to some embodiments, the absolute time of expiry is represented by unix timestamps.
According to some embodiments, the second determination unit comprises: and a module for determining a child termination time at which processing for the child request can be completed, based on a result of the test for the child request in advance.
According to some embodiments, the second determination unit comprises: and a module that determines a sub-termination time at which processing for the sub-request can be completed, based on a time length taken to complete a processing task for the sub-request in the history time.
According to some embodiments, the apparatus further comprises: a fourth determining unit configured to determine a distribution order of at least one sub-request to be distributed; and a fifth determining unit configured to determine, for any one of the at least one sub-request, that distribution of a sub-request located after the sub-request in the distribution order is not performed in response to determining that distribution for the sub-request is not performed.
According to another aspect of the present disclosure, there is also provided a computing device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform any of the methods described above.
According to another aspect of the present disclosure, there is also provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform any of the methods described above.
According to another aspect of the present disclosure, there is also provided a computer program product comprising a computer program, wherein the computer program realizes any of the above methods when executed by a processor.
Referring to fig. 6, a block diagram of a structure of an electronic device 600, which may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic device is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The calculation unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. The input unit 606 may be any type of device capable of inputting information to the device 600, and the input unit 606 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and/or a remote control. Output unit 607 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, a video/audio output terminal, a vibrator, and/or a printer. The storage unit 608 may include, but is not limited to, a magnetic disk, an optical disk. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and/or a chipset, such as a bluetooth (TM) device, an 1302.11 device, a WiFi device, a WiMax device, a cellular communication device, and/or the like.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 601 performs the respective methods and processes described above, such as the service request processing method. For example, in some embodiments, the service request processing method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the service request processing method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the service request processing method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be performed in parallel, sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
Although embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it is to be understood that the above-described methods, systems and apparatus are merely exemplary embodiments or examples and that the scope of the present invention is not limited by these embodiments or examples, but only by the claims as issued and their equivalents. Various elements in the embodiments or examples may be omitted or may be replaced with equivalents thereof. Further, the steps may be performed in an order different from that described in the present disclosure. Further, various elements in the embodiments or examples may be combined in various ways. It is important that as technology evolves, many of the elements described herein may be replaced with equivalent elements that appear after the present disclosure.

Claims (19)

1. A method for processing service requests comprises the following steps:
receiving a service request, wherein the service request comprises a termination time identifier used for indicating service termination time;
determining at least one sub-request to be distributed based on the service request; and
for any of the at least one sub-request,
determining a child termination time at which a processing task for the child request can be completed; and
in response to determining that the child termination time exceeds the service termination time indicated by the termination time indicator, determining not to perform distribution for the child request.
2. The method of claim 1, wherein the termination time is identified as a relative termination time, the relative termination time representing a remaining duration from the service termination time.
3. The method of claim 2, further comprising:
before determining at least one sub-request to be distributed based on the service request, converting the relative termination time into an absolute termination time, wherein the absolute termination time is a service termination time.
4. The method of claim 3, wherein said converting the relative end time to an absolute end time comprises:
determining the current time based on the local clock; and
determining the absolute end time based on the current time and the relative end time.
5. The method according to claim 3 or 4, wherein the absolute time of expiry is expressed in unix timestamps.
6. The method of claim 1, wherein the determining a child termination time at which the processing task for the child request can be completed comprises:
a child termination time at which a processing task for the child request can be completed is determined based on a result of the preliminary offline test for the child request.
7. The method of claim 1, wherein the determining a child termination time at which the processing task for the child request can be completed comprises:
the sub-termination time at which the processing task for the sub-request can be completed is determined based on the length of time taken to complete the processing task for the sub-request in the history time.
8. The method of claim 1, further comprising:
determining a distribution order of the at least one sub-request to be distributed; and
for any of the at least one sub-request, in response to determining not to perform distribution for the sub-request, determining not to perform distribution for sub-requests that follow the sub-request in the distribution order.
9. An apparatus for processing service requests, comprising:
a receiving unit, configured to receive a service request, where the service request includes a termination time identifier indicating a service termination time;
a first determining unit configured to determine at least one sub-request to be distributed based on the service request; and
a second determining unit configured to determine, for any of the at least one sub-request,
determining a child termination time at which a processing task for the child request can be completed; and
in response to determining that the child termination time exceeds the service termination time indicated by the termination time indicator, determining not to perform distribution for the child request.
10. The apparatus of claim 9, wherein the termination time is identified as a relative termination time, the relative termination time representing a remaining duration from the service termination time.
11. The apparatus of claim 10, further comprising:
a third determining unit configured to convert the relative termination time into an absolute termination time before determining at least one sub-request to be distributed based on the service request, wherein the absolute termination time is a service termination time.
12. The apparatus of claim 11, wherein the third determining unit comprises:
a module for determining a current time based on a local clock; and
means for determining the absolute end time based on the current time and the relative end time.
13. The apparatus according to claim 11 or 12, wherein the absolute time of expiry is expressed in unix timestamps.
14. The apparatus of claim 9, wherein the second determining unit comprises:
and determining a sub-termination time at which the processing task for the sub-request can be completed based on a result of the pre-offline test for the sub-request.
15. The apparatus of claim 9, wherein the second determining unit comprises:
and a module that determines a child termination time at which the processing task for the child request can be completed, based on a time length taken to complete the processing task for the child request in the history time.
16. The apparatus of claim 9, further comprising:
a fourth determining unit configured to determine a distribution order of the at least one sub-request to be distributed; and
a fifth determining unit configured to determine, for any of the at least one sub-request, that distribution of a sub-request located after the sub-request in the distribution order is not to be performed in response to determining that distribution for the sub-request is not to be performed.
17. A computing device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
18. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-8.
19. A computer program product comprising a computer program, wherein the computer program realizes the method of any one of claims 1-8 when executed by a processor.
CN202110654897.XA 2021-06-11 2021-06-11 Service request processing method and device, computer equipment and medium Pending CN113296955A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110654897.XA CN113296955A (en) 2021-06-11 2021-06-11 Service request processing method and device, computer equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110654897.XA CN113296955A (en) 2021-06-11 2021-06-11 Service request processing method and device, computer equipment and medium

Publications (1)

Publication Number Publication Date
CN113296955A true CN113296955A (en) 2021-08-24

Family

ID=77328016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110654897.XA Pending CN113296955A (en) 2021-06-11 2021-06-11 Service request processing method and device, computer equipment and medium

Country Status (1)

Country Link
CN (1) CN113296955A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107920120A (en) * 2017-11-22 2018-04-17 北京小米移动软件有限公司 Method for processing business, device and computer-readable recording medium
US20190158566A1 (en) * 2017-11-22 2019-05-23 International Business Machines Corporation Asynchronously reading http responses in separate process
CN112631887A (en) * 2020-12-25 2021-04-09 百度在线网络技术(北京)有限公司 Abnormality detection method, abnormality detection device, electronic apparatus, and computer-readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107920120A (en) * 2017-11-22 2018-04-17 北京小米移动软件有限公司 Method for processing business, device and computer-readable recording medium
US20190158566A1 (en) * 2017-11-22 2019-05-23 International Business Machines Corporation Asynchronously reading http responses in separate process
CN112631887A (en) * 2020-12-25 2021-04-09 百度在线网络技术(北京)有限公司 Abnormality detection method, abnormality detection device, electronic apparatus, and computer-readable storage medium

Similar Documents

Publication Publication Date Title
CN112925651A (en) Application resource deployment method, device, electronic equipment and medium
CN113986788A (en) Data processing method and device, chip, electronic device and medium
CN112925652B (en) Application resource deployment method, device, electronic equipment and medium
CN114091672B (en) Distributed model reasoning method and device, electronic equipment and medium
CN115604144A (en) Test method and device, electronic equipment and storage medium
CN112559498B (en) Method and device for constructing distributed architecture of time sequence space-time database system
CN112732312A (en) Method and device for updating application program, electronic equipment and medium
CN112860566A (en) Applet detection method, device, electronic equipment and readable medium
CN113641929B (en) Page rendering method, device, electronic equipment and computer readable storage medium
CN114510308B (en) Method, device, equipment and medium for storing application page by mobile terminal
CN113296955A (en) Service request processing method and device, computer equipment and medium
CN115391041A (en) Task processing method and device, electronic equipment and storage medium
CN115237574A (en) Scheduling method and device of artificial intelligence chip and electronic equipment
CN114095564A (en) Data processing method and device, equipment and medium
CN113126928A (en) File moving method and device, electronic equipment and medium
CN112925623A (en) Task processing method and device, electronic equipment and medium
CN116016373A (en) Method, device, equipment and medium for sending data processing request
CN114566148B (en) Cluster voice recognition service, detection method and device thereof and electronic equipment
CN113676746B (en) Method, apparatus, device and medium for detecting live broadcast jitter
CN115334159B (en) Method, apparatus, device and medium for processing stream data
CN113010383B (en) Error log filtering method, device, electronic equipment and readable medium
CN115145618A (en) Service version updating method and device, electronic equipment and storage medium
CN113902313A (en) Object information processing method and device
CN116541090A (en) Data processing method, device, equipment and medium
CN115454647A (en) Data processing method and device, equipment and 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