Request processing method, device, computer equipment, readable storage medium and program product
By introducing a request cache queue and a processing queue in the storage system, data processing requests are processed in batches according to the queue parameters, the problem of poor processing request stability is solved and processing efficiency is improved.
Patent Information
- Application Number
- CN202411649410.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-04-04
Smart Images

Figure CN119759254A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a request processing method, apparatus, computer equipment, readable storage medium and program product. Background Art
[0002] When a storage system performs management operations (such as reading and modifying) on data in a disk, related processing requests are usually generated, and corresponding management operations are performed on the data in the disk based on these processing requests.
[0003] In the related art, when processing requests are detected, these processing requests are directly sent to the relevant processing service of the disk for processing.
[0004] However, the above request processing process has the problem of poor processing stability. Summary of the invention
[0005] Based on this, it is necessary to provide a request processing method, apparatus, computer equipment, readable storage medium and program product that can improve processing stability in response to the above technical problems.
[0006] In a first aspect, the present application provides a request processing method, comprising:
[0007] When the request queue transfer condition is met, extract the data processing request from the request cache queue and write the data processing request into the request processing queue;
[0008] Obtaining queue parameters of the request processing queue, and extracting target data processing requests from the request processing queue according to the queue parameters;
[0009] Respond to target data processing requests.
[0010] In this way, all received data processing requests are not sent directly to the disk-related processing service for processing, but are first stored in the request cache queue. When the request queue transfer conditions are met, they are extracted from the request cache queue and placed in the write request queue. A batch of target data processing requests that can be responded to are extracted according to the queue parameters corresponding to the request queue. This avoids the problem of large fluctuations in the amount of data processed by the disk management service caused by directly sending the processing requests to the disk-related processing service for processing in the traditional technology. The technical solution provided by the present application enables data processing requests to be processed in batches at appropriate times, thereby improving the stability of the data processing request processing process.
[0011] In one embodiment, the queue parameter includes a queue length of the request processing queue, and extracting the target data processing request from the request processing queue according to the queue parameter includes:
[0012] Check whether the queue length is greater than the preset aggregation length and obtain the test result;
[0013] According to the detection result, the target data processing request is extracted from the request processing queue.
[0014] In this way, the target data processing request is determined based on the detection result corresponding to whether the queue length that can characterize the number of data requests is greater than the preset aggregation length, so that the data processing requests can be extracted in batches, thereby realizing batch processing of data processing requests.
[0015] In one embodiment, extracting a target data processing request from a request processing queue includes:
[0016] If the detection result is that the queue length is greater than or equal to the preset aggregation length, the target data processing request is extracted from the request processing queue according to the number of requests corresponding to the preset aggregation length.
[0017] In this way, the purpose of batch-aggregate processing of target data processing requests is achieved, and the processing efficiency is improved.
[0018] In one embodiment, the method further comprises:
[0019] If the detection result is that the queue length is less than the preset aggregation length, and the queue length is less than the preset non-aggregation length, then detect whether the time difference between the time when the data processing request was last written in the request processing queue and the current time is greater than the waiting time threshold, and the preset non-aggregation length is less than the preset aggregation length;
[0020] If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue and all data processing requests are used as target data processing requests.
[0021] In this way, when the server detects that the queue length is less than the preset non-aggregate length, and the time difference between the time when the data processing request was last written in the request processing queue and the current time is greater than the waiting time threshold, it means that no new data processing request has been written to the current request processing queue for a long time. If it continues to wait for new data processing requests to be written to achieve forced aggregation processing, the processing efficiency will be reduced. Therefore, the server can extract all data processing requests from the request processing queue at this time, and use all data processing requests as target data processing requests. In this way, the problem of low processing efficiency caused by forced aggregation processing is avoided.
[0022] In one embodiment, before extracting the data processing request from the request cache queue, the method further includes:
[0023] Writing the received data processing request into the request cache queue;
[0024] When there is a waiting task for a data processing request, the request identifier corresponding to the data processing request is determined according to the relative position of the data processing request in the request cache queue, and the waiting task and the request identifier are written into the waiting queue accordingly. The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
[0025] In this way, for some special data processing requests, such as dependent requests, traditional technologies may need to continuously process the associated data processing requests. In order to reduce the waste of computing resources, there is no need to add additional threads to maintain the dependencies of these data processing requests. A waiting task can be set for the last data processing request among the data processing requests with dependencies. The waiting task can include a callback function. When the last data processing request is completed, the corresponding waiting task can be triggered to run the callback function, thereby completing subsequent operations.
[0026] In one embodiment, the method further comprises:
[0027] For each target data processing request, when a request response corresponding to the target data processing request is detected, the target interface is called according to the interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request;
[0028] Determine whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue;
[0029] If there is a target waiting task, it is determined whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue.
[0030] In the above embodiment, it is determined whether there is a target waiting task for the target data request based on the target request identifier, and if there is a target waiting task, it is determined whether to trigger the target waiting task based on the request processing result, the target request identifier and the waiting queue. Methods for triggering the target waiting task in different situations are given, thereby improving the flexibility of the triggering method of the target waiting task.
[0031] In one embodiment, determining whether to trigger a target waiting task according to a request processing result, a target request identifier, and a waiting queue includes:
[0032] If the request type of the target data processing request is a dependent request type, and a request response corresponding to a dependent data processing request having a dependent relationship with the target data processing request is detected, then extracting a target waiting task from the waiting queue according to the target request identifier;
[0033] The target waiting task is triggered according to the request processing result and the dependent request processing results corresponding to each dependent data processing request.
[0034] In this way, for target data processing requests of dependent request types, the server can maintain its associated dependency relationships according to the target waiting tasks, without the need for redundant threads to maintain their dependencies, thereby reducing the waste of computing resources.
[0035] In one embodiment, the method further comprises:
[0036] If the request type of the target data processing request is a non-dependent request type, extracting the target waiting task from the waiting queue according to the target request identifier;
[0037] According to the request processing result, the target waiting task is triggered.
[0038] In this way, for target data processing requests of non-dependent request types, when there is a target waiting task, the server directly triggers the target waiting task without waiting for the trigger, which promotes the processing progress of the request and improves the efficiency of data processing.
[0039] In one embodiment, the request queue transfer condition includes at least one of executing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching a transfer time corresponding to a request queue transfer cycle at the current time.
[0040] In this way, the timing of dequeuing the request cache queue is set, including writing the data processing request into the request cache queue, any data processing request being processed, and the set queue transfer cycle (such as queue transfer once every 10 minutes), etc., so that the data processing requests in the request cache queue can be continuously transferred to the queue, thereby promoting the processing progress of the data processing requests.
[0041] In one embodiment, there are multiple target data processing requests, and responding to the target data processing requests includes:
[0042] Obtaining the disk access location corresponding to each target data processing request;
[0043] Determine the sorting order of each target data processing request according to each disk access position;
[0044] Respond to each target data processing request according to the sorting order.
[0045] In this way, the target data processing request is responded to in order of its corresponding disk access position, thereby achieving continuous processing and improving processing efficiency.
[0046] In a second aspect, the present application further provides a request processing device, including:
[0047] A processing module, used for extracting a data processing request from a request cache queue and writing the data processing request into a request processing queue when a request queue transfer condition is met;
[0048] An acquisition module is used to acquire queue parameters of a request processing queue and extract a target data processing request from the request processing queue according to the queue parameters;
[0049] The response module is used to respond to the target data processing request.
[0050] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0051] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method of the first aspect described above.
[0052] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method in the first aspect are implemented.
[0053] The above-mentioned request processing method, device, computer equipment, readable storage medium and program product can obtain the queue parameters of the request processing queue by extracting the data processing request from the request cache queue and writing the data processing request into the request processing queue when the request queue transfer condition is met, and extract the target data processing request from the request processing queue according to the queue parameters, so as to respond to the target data processing request. In this way, all received data processing requests are not directly sent to the disk-related processing service for processing, but are first stored in the request cache queue, and then extracted from the request cache queue and put into the write request queue when the request queue transfer condition is met, and a batch of target data processing requests that can be responded to are extracted according to the queue parameters corresponding to the request queue, thus avoiding the problem of large fluctuations in the amount of data processed by the disk management service caused by directly sending the processing request to the disk-related processing service for processing in the traditional technology. The technical solution provided by the present application enables data processing requests to be processed in batches at appropriate times, thereby improving the stability of the data processing request processing process. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 Related processing architecture diagram of processing requests in traditional technology;
[0056] Figure 2 An application environment diagram of a request processing method in an embodiment;
[0057] Figure 3 A diagram of a related processing architecture for processing a request in one embodiment;
[0058] Figure 4 A schematic diagram of a request processing method in one embodiment;
[0059] Figure 5 is a flow chart of step 402 in another embodiment;
[0060] Figure 6 A schematic diagram of a flow chart before extracting a data processing request from a request cache queue in another embodiment;
[0061] Figure 7 is a flow chart of responding to a target data processing request in another embodiment;
[0062] Figure 8 is a flowchart of an exemplary request processing method in another embodiment;
[0063] Fig. 9 is an exemplary functional module structure diagram in another embodiment;
[0064] Fig.10 is a structural block diagram of a request processing device in one embodiment;
[0065] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0067] When a storage system performs management operations (such as reading and modifying) on data in the disk, in order to improve disk utilization, related management services are usually introduced before the disk driver, such as the disk access layer, which can uniformly handle processing requests for data in the disk.
[0068] The related processing architecture of processing requests in traditional technology can refer to Figure 1 Among them, the protocol layer can provide an operation interface for inputting processing requests to the outside. The processing requests are divided into two types according to the different types of data to be processed. One is the processing request corresponding to ordinary data, and the other is the processing request corresponding to metadata. After the server detects the processing request corresponding to ordinary data, it will directly send the processing request to the disk access layer for processing; and after the server detects the processing request corresponding to metadata, it will first submit it to the log module in the form of a transaction. The log module needs to solidify the processing request in the disk, so it will submit the relevant cache request to the disk access layer for processing. At the same time, the log module will also try to read the metadata related to the processing request from the cache according to the content of the processing request. If it is not read, the cache module will send the processing request to the disk access layer for reading. If it is read and the relevant metadata is processed in the cache module, in order to ensure data consistency, a corresponding flush processing request will be generated in the cache module and sent to the disk access layer for processing.
[0069] In the above request processing process, after detecting the processing request, these processing requests will be sent directly to the relevant processing service on the disk for processing. However, the generation of processing requests is volatile. If they are all sent directly to the relevant processing service for processing, the amount of request data processed by the relevant processing service for a period of time will be too large, resulting in a shortage of computing resources. If the amount of request data processed for a period of time is too small, the computing resources will be idle, and there will be a problem of poor processing stability.
[0070] In view of this, the present application provides a request processing method, device, computer equipment, readable storage medium and program product. When the request queue transfer condition is met, by extracting the data processing request from the request cache queue and writing the data processing request into the request processing queue, the queue parameters of the request processing queue can be obtained, and according to the queue parameters, the target data processing request can be extracted from the request processing queue to respond to the target data processing request. In this way, all received data processing requests are not directly sent to the relevant processing service of the disk for processing, but are first stored in the request cache queue. When the request queue transfer condition is met, they are extracted from the request cache queue and put into the write request queue. According to the queue parameters corresponding to the request queue, a batch of target data processing requests that can be responded to are extracted, which avoids the problem of large fluctuations in the amount of data processed by the disk management service caused by directly sending the processing request to the disk-related processing service for processing in the traditional technology. The technical solution provided by the present application enables data processing requests to be processed in batches at appropriate times, thereby improving the stability of the data processing request processing process.
[0071] The request processing method provided in the embodiment of the present application can be applied to Figure 2 In the application environment shown. Among them, the data storage system can store the data that the server 201 needs to process. The data storage system can be integrated on the server 201, or it can be placed on the cloud or other network servers. The server 201 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0072] In a possible implementation, the server's processing architecture for data processing requests can refer to Figure 3 By adding a stabilizer service in the process of sending a data processing request to a related processing service for response, the server 201 can implement the method steps in any of the following embodiments through the stabilizer service.
[0073] In an exemplary embodiment, Figure 4 As shown, a request processing method is provided, which is applied to Figure 2 The server 201 in the example is used as an example to illustrate, including the following steps 401 to 403. Among them:
[0074] Step 401: When the request queue transfer condition is met, extract the data processing request from the request cache queue and write the data processing request into the request processing queue.
[0075] The data processing request may be a request to instruct relevant processing of the data in the disk. In the embodiment of the present application, the server may obtain the data processing request input by the user through an external device, or may detect the data processing request generated by the system itself.
[0076] When the server detects a data processing request, it will first write the data processing request into the request cache queue for waiting, and will continuously check whether the current system meets the request queue transfer conditions. Optionally, the server can detect in real time whether the current system meets the request queue transfer conditions; optionally, the server can periodically detect whether the current system meets the request queue transfer conditions.
[0077] In an embodiment of the present application, the request queue transfer conditions include performing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching at least one of the transfer time corresponding to the request queue transfer cycle at the current time.
[0078] In this way, the timing of dequeuing the request cache queue is set, including writing the data processing request into the request cache queue, any data processing request being processed, and the set queue transfer cycle (such as queue transfer once every 10 minutes), etc., so that the data processing requests in the request cache queue can be continuously transferred to the queue, thereby promoting the processing progress of the data processing requests.
[0079] When the server detects that the current system meets the request queue transfer condition, it extracts the data processing request from the request cache queue and writes the extracted data processing request into the request processing queue to wait for processing.
[0080] In an embodiment of the present application, the server can extract data processing requests according to preset extraction conditions. Optionally, the server can extract data processing requests according to a preset quantity. Optionally, the server can extract data processing requests according to a preset quantity threshold. For example, when the number of data processing requests in the request cache queue reaches the quantity threshold, it means that there are too many data processing requests in the current request cache queue. The server can increase the number of extracted data processing requests according to a preset gain quantity, and extract data processing requests according to the increased number of data processing requests. If the number of data processing requests in the request cache queue does not reach the quantity threshold, the server can extract data processing requests according to the preset quantity threshold.
[0081] Step 402: Obtain queue parameters of the request processing queue, and extract the target data processing request from the request processing queue according to the queue parameters.
[0082] In an embodiment of the present application, the request processing queue stores data processing requests to be processed, and the server can obtain queue parameters corresponding to the request processing queue, thereby determining the timing of extracting the target data processing request from the request processing queue based on the queue parameters.
[0083] In a possible implementation, the queue parameter may be the queue length of the request processing queue. The server may preset an aggregation threshold and compare the queue length with the preset aggregation threshold. If the queue length is greater than or equal to the preset aggregation threshold, the server may extract data processing requests from the request processing queue according to the preset aggregation threshold and use the extracted data processing requests as target data processing requests. In this way, aggregate processing of data processing requests is achieved.
[0084] In another possible implementation, the queue parameters may also include the waiting time from the time when the most recent data processing request was written to the current time and the queue length of the request processing queue. When the server detects that the queue length of the request processing queue is less than a preset non-aggregation threshold and the waiting time is greater than a preset time threshold, it means that no data processing request has been written to the request processing queue for a long time. In order to avoid the problem of low processing efficiency caused by forced aggregation of data processing requests that cannot be processed, at this time, the server can extract the target data processing request from the request processing queue according to the preset data volume, or the server can directly extract all the data processing requests in the request processing queue and use the extracted data processing requests as the target data processing requests.
[0085] Step 403, respond to the target data processing request.
[0086] After the target data processing request is extracted from the request processing queue, the server can respond to the target data processing request. In a possible implementation, when the number of target data processing requests can be one or more, the server can directly send the target data processing requests of this batch to the relevant processing service of the disk, so that the relevant processing service can process and respond to the target data processing request.
[0087] In another possible implementation, there are multiple target data processing requests. In order to improve processing efficiency, the server can obtain the disk access position corresponding to each target data processing request, and determine the sorting order of each target data processing request based on each disk access position, and then respond to each target data processing request according to the sorting order.
[0088] In this way, the target data processing request is responded to in order of its corresponding disk access position, thereby achieving continuous processing and improving processing efficiency.
[0089] In the above embodiment, all received data processing requests are not sent directly to the disk-related processing service for processing, but are first stored in a request cache queue. When the request queue transfer condition is met, they are extracted from the request cache queue and placed in a write request queue. A batch of target data processing requests that can be responded to are extracted according to the queue parameters corresponding to the request queue. This avoids the problem of large fluctuations in the amount of data processed by the disk management service caused by directly sending the processing requests to the disk-related processing service for processing in the traditional technology. The technical solution provided by the present application enables data processing requests to be processed in batches at appropriate times, thereby improving the stability of the data processing request processing process.
[0090] In one embodiment, based on the above Figure 4 The embodiment shown, referring to Figure 5 This embodiment relates to a process of extracting a target data processing request from a request processing queue according to a queue parameter. In this embodiment, the queue parameter includes the queue length of the request processing queue. Figure 5 As shown, in this embodiment, step 402 includes Figure 5 Step 501 and step 502 are shown.
[0091] Step 501, detect whether the queue length is greater than a preset aggregation length, and obtain a detection result.
[0092] Step 502: extract the target data processing request from the request processing queue according to the detection result.
[0093] In the embodiment of the present application, the queue parameter is the queue length, and the queue length can represent the number of data processing requests in the request processing queue.
[0094] In one possible implementation, the server may detect whether the queue length is greater than a preset aggregation length. Optionally, if the detection result is that the queue length is greater than or equal to the preset aggregation length, then it indicates that the number of data processing requests in the current request processing queue has reached the minimum number for aggregate processing; optionally, if the queue length is less than the preset aggregation length, then it indicates that the number of data processing requests in the request processing queue has not reached the minimum number for aggregate processing.
[0095] The server can extract the target data processing request from the request processing queue based on the monitoring results. In one possible implementation, if the detection result is that the queue length is greater than or equal to the preset aggregation length, the server can extract the target data processing request from the request processing queue based on the number of requests corresponding to the preset aggregation length.
[0096] In this way, the purpose of batch-aggregate processing of target data processing requests is achieved, and the processing efficiency is improved.
[0097] In another possible implementation, if the detection result is that the queue length is less than the preset aggregation length, and the queue length is less than the preset non-aggregation length, the server can detect whether the time difference between the time when the data processing request was last written into the request processing queue and the current time is greater than the waiting time threshold. If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue, and all data processing requests are used as target data processing requests.
[0098] In order to avoid the problem of low processing efficiency caused by forced aggregation processing, in an embodiment of the present application, the server can preset a non-aggregation length, wherein the preset non-aggregation length is less than the preset aggregation length. The server can detect whether the queue length is less than the preset non-aggregation length, and whether the time difference between the moment when the data processing request was last written in the request processing queue and the current moment is greater than the waiting time threshold. If the above two conditions are met at the same time, it means that no new data processing request has been written to the current request processing queue for a long time. If the server continues to wait for new data processing requests to be written to realize forced aggregation processing, the processing efficiency will be reduced. Therefore, the server can extract all data processing requests from the request processing queue at this time, and use all data processing requests as target data processing requests. In this way, the problem of low processing efficiency caused by forced aggregation processing is avoided.
[0099] In this way, the target data processing request is determined based on the detection result corresponding to whether the queue length that can characterize the number of data requests is greater than the preset aggregation length, so that the data processing requests can be extracted in batches, thereby realizing batch processing of data processing requests.
[0100] In one embodiment, based on the above Figure 4 and 5 The embodiment shown, referring to Figure 6 , this embodiment relates to the process before extracting the data processing request from the request cache queue. Figure 6 As shown, in this embodiment, before extracting the data processing request from the request cache queue, the process also includes Figure 6 Step 601 and step 602 are shown.
[0101] Step 601: Write the received data processing request into the request cache queue.
[0102] In an embodiment of the present application, the data processing request may be a processing request corresponding to ordinary data or a processing request corresponding to metadata. After receiving the data processing request, the server may write the data processing request into a request cache queue for processing. In one possible implementation, when the data processing request is written into the request cache queue, the server obtains request information related to the data processing request. The request information may include a request processing process, an error code acquisition method, an execution result query, a request type, etc., wherein the request type may include an independent request and a dependent request. An independent request indicates that there is no association between the data processing request and other data processing requests, while a dependent request indicates that there is a dependency between the data processing request and other data processing requests (such as the processing result after the current data processing request is processed is the input for the next data processing request).
[0103] Step 602: if there is a waiting task for the data processing request, determine the request identifier corresponding to the data processing request according to the relative position of the data processing request in the request cache queue, and write the waiting task and the request identifier into the waiting queue accordingly.
[0104] The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
[0105] The server can detect whether there is a waiting task for the data processing request. In the embodiment of the present application, the waiting task may include a callback function. For some special data processing requests, after they are processed, it may be necessary to trigger the corresponding waiting task. For example, for dependent requests, traditional technologies may need to continuously process the associated data processing requests. In order to reduce the waste of computing resources, there is no need to add additional threads to maintain the dependencies of these data processing requests. A waiting task can be set for the last data processing request among the data processing requests with dependencies. The waiting task can include a callback function. When the last data processing request is completed, its corresponding waiting task can be triggered to run the callback function, thereby completing subsequent operations.
[0106] Therefore, in an embodiment of the present application, when the server can detect whether there is a waiting task for a data processing request, optionally, the data processing request may include a corresponding waiting task, optionally, there is a mapping relationship in the data processing request that can determine the corresponding waiting task, and the server can determine the corresponding waiting task based on the mapping relationship.
[0107] After the server determines the waiting task, in order to associate the waiting task with the data processing request, in an embodiment of the present application, the server will also assign a corresponding request identifier to the data processing request when writing the data processing request into the request cache queue. The request identifier is related to the relative position of the data processing request in the request cache queue and can be used to uniquely identify the data processing request.
[0108] In this way, the server can write the waiting task and the request identifier into the waiting queue. During the subsequent processing, if it is detected that the data processing request has been processed, the server can determine the corresponding waiting task from the waiting queue according to the corresponding request identifier to complete the subsequent operation.
[0109] In the above embodiment, for some special data processing requests, such as dependent requests, traditional technologies may need to continuously process the associated data processing requests. In order to reduce the waste of computing resources, it is not necessary to add additional threads to maintain the dependencies of these data processing requests. A waiting task can be set for the last data processing request among the data processing requests with dependencies. The waiting task can include a callback function. When the last data processing request is completed, the corresponding waiting task can be triggered to run the callback function, thereby completing subsequent operations.
[0110] In one embodiment, based on the embodiment shown in 6 above, referring to Figure 7 , this embodiment involves the process of responding to a target data processing request. Figure 7 As shown, in this embodiment, the process also includes Figure 7 Steps 701 to 703 are shown.
[0111] Step 701, for each target data processing request, when a request response corresponding to the target data processing request is detected, the target interface is called according to the interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request.
[0112] In an embodiment of the present application, after the server starts responding to each target data processing request, it can determine whether a request response corresponding to the target data processing request is detected. Optionally, if it is detected, it means that the target data processing request is processed. Optionally, if it is not detected, it means that the target data processing request has not been processed.
[0113] After detecting the request response, the server can obtain the request processing result corresponding to the target data processing request. The request processing result can be used to characterize the processing result of the target data processing request. For example, it can be a processing failure or a processing success. Optionally, the processing result can also be some preset values.
[0114] In an embodiment of the present application, the target data processing request includes an interface field corresponding to the interface for obtaining the request processing result. The server can determine the target interface through this field and call it to obtain the request processing result. The interface can be a get error interface.
[0115] Step 702: Determine whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue.
[0116] After obtaining the request processing result, the server may query from the waiting queue according to the target request identifier corresponding to the target data processing request, thereby determining whether there is a target waiting task for the target data processing request.
[0117] Step 703: If there is a target waiting task, determine whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue.
[0118] In a possible implementation, if there is a target waiting task corresponding to the target data processing request, the server may determine whether to trigger the target waiting task according to the request processing result, the target request identifier, and the waiting queue.
[0119] Optionally, if the request type of the target data processing request is a dependent request type, and a request response corresponding to a dependent data processing request that has a dependency relationship with the target data processing request is detected, the target waiting task is extracted from the waiting queue according to the target request identifier, and the server can trigger the target waiting task based on the request processing result and the dependent request processing result corresponding to each dependent data processing request.
[0120] In this embodiment, if the request type of the target data processing request is a dependent request type, it can be determined that the target data processing request is associated with other data processing requests, and the server needs to determine that other data processing requests have also been processed before the target waiting task can be triggered. Therefore, the server needs to detect the request response corresponding to the dependent data processing request that has a dependent relationship with the target data processing request, and then extract the target waiting task from the target request identifier waiting queue corresponding to the target data processing request. After extracting the target waiting task, the server can trigger the target waiting task. The target waiting task can be to output the processing results of the target data processing request and other data processing requests associated with it, and the target waiting task can also be to archive the processing results of the target data processing request and other data processing requests associated with it, so as to facilitate subsequent processing.
[0121] In this way, for target data processing requests of dependent request types, the server can maintain its associated dependency relationships according to the target waiting tasks, without the need for redundant threads to maintain their dependencies, thereby reducing the waste of computing resources.
[0122] Optionally, if the request type of the target data processing request is a non-dependent request type, the target waiting task is extracted from the waiting queue according to the target request identifier, and the target waiting task is triggered according to the request processing result.
[0123] In this way, for target data processing requests of non-dependent request types, when there is a target waiting task, the server directly triggers the target waiting task without waiting for the trigger, which promotes the processing progress of the request and improves the efficiency of data processing.
[0124] In another possible implementation, if the target data processing request does not have the corresponding target waiting task, the server may output the target request identifier and the request processing result.
[0125] In the above embodiment, it is determined whether there is a target waiting task for the target data request based on the target request identifier, and if there is a target waiting task, it is determined whether to trigger the target waiting task based on the request processing result, the target request identifier and the waiting queue. Methods for triggering the target waiting task in different situations are given, thereby improving the flexibility of the triggering method of the target waiting task.
[0126] In one possible implementation, the server can monitor the processing stage of the data processing request by detecting relevant parameters of the request cache queue and the request processing queue during the process of processing each data processing request. In an embodiment of the present application, the server can detect the starting identifier, queue length, etc. of the request processing queue in real time. Since the request identifier of each data processing request is related to its relative position in the request cache queue, the server can determine the processing status of the data processing request based on the request identifier, starting identifier, queue length, etc. The processing status may include pending, processing, and processed.
[0127] In one embodiment, please refer to Figure 8 , which shows a flowchart of an exemplary request processing method provided in an embodiment of the present application, which can be applied to Figure 2 In the implementation environment shown.
[0128] Step 801: Write the received data processing request into the request cache queue.
[0129] Step 802, when there is a waiting task for the data processing request, determine the request identifier corresponding to the data processing request according to the relative position of the data processing request in the request cache queue, and write the waiting task and the request identifier into the waiting queue accordingly.
[0130] The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
[0131] Step 803: When the request queue transfer condition is met, extract the data processing request from the request cache queue and write the data processing request into the request processing queue.
[0132] The request queue transfer condition includes at least one of executing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching a transfer time corresponding to a request queue transfer cycle at the current time.
[0133] Step 804, obtaining queue parameters of the request processing queue.
[0134] The queue parameters include the queue length of the request processing queue.
[0135] Step 805, detecting whether the queue length is greater than a preset aggregation length, and obtaining a detection result.
[0136] Step 806: If the detection result is that the queue length is greater than or equal to the preset aggregation length, then the target data processing request is extracted from the request processing queue according to the number of requests corresponding to the preset aggregation length.
[0137] Step 807, if the detection result is that the queue length is less than the preset aggregation length and the queue length is less than the preset non-aggregation length, then detect whether the time difference between the time when the data processing request was last written in the request processing queue and the current time is greater than the waiting time threshold.
[0138] The preset non-aggregation length is smaller than the preset aggregation length.
[0139] Step 808: If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue, and all data processing requests are used as target data processing requests.
[0140] There are multiple target data processing requests.
[0141] Step 809: Obtain the disk access location corresponding to each target data processing request.
[0142] Step 810, determining the sorting order of each target data processing request according to each disk access position.
[0143] Step 811, respond to each target data processing request according to the sorting order.
[0144] Step 812, for each target data processing request, when a request response corresponding to the target data processing request is detected, the target interface is called according to the interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request.
[0145] Step 813: Determine whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue.
[0146] Step 814, if there is a target waiting task, and the request type of the target data processing request is a dependent request type, and a request response corresponding to a dependent data processing request that has a dependency relationship with the target data processing request is detected, then the target waiting task is extracted from the waiting queue according to the target request identifier.
[0147] Step 815 , triggering the target waiting task according to the request processing result and the dependent request processing results corresponding to each dependent data processing request.
[0148] Step 816: If there is a target waiting task, and the request type of the target data processing request is a non-dependent request type, extract the target waiting task from the waiting queue according to the target request identifier.
[0149] Step 817, triggering the target waiting task according to the request processing result.
[0150] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0151] In one possible implementation, refer to Fig. 9 , can be Fig. 9 The functional module structure diagram in the embodiment implements the method steps in the above embodiment.
[0152] Based on the same inventive concept, the embodiment of the present application also provides a request processing device for implementing the request processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more request processing device embodiments provided below can refer to the limitations on the request processing method above, and will not be repeated here.
[0153] In an exemplary embodiment, Fig.10As shown, a request processing device is provided, including: a processing module 1001, an acquisition module 1002 and a response module 1003, wherein:
[0154] The processing module 1001 is used to extract the data processing request from the request cache queue and write the data processing request into the request processing queue when the request queue transfer condition is met;
[0155] An acquisition module 1002 is used to acquire queue parameters of the request processing queue and extract a target data processing request from the request processing queue according to the queue parameters;
[0156] The response module 1003 is used to respond to the target data processing request.
[0157] In one embodiment, the queue parameter includes the queue length of the request processing queue, and the acquisition module 1002 includes:
[0158] A detection unit, used to detect whether the queue length is greater than a preset aggregation length, and obtain a detection result;
[0159] An extraction unit is used to extract the target data processing request from the request processing queue according to the detection result.
[0160] In one embodiment, the extraction unit is specifically configured to perform:
[0161] If the detection result is that the queue length is greater than or equal to the preset aggregation length, the target data processing request is extracted from the request processing queue according to the number of requests corresponding to the preset aggregation length.
[0162] In one embodiment, the extraction unit is further configured to perform:
[0163] If the detection result is that the queue length is less than the preset aggregation length, and the queue length is less than the preset non-aggregation length, then detecting whether the time difference between the time when the last data processing request was written in the request processing queue and the current time is greater than the waiting time threshold, and the preset non-aggregation length is less than the preset aggregation length;
[0164] If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue, and all the data processing requests are used as the target data processing requests.
[0165] In one embodiment, the apparatus further comprises:
[0166] A receiving module, used for writing the received data processing request into the request cache queue;
[0167] A waiting allocation module is used to determine the request identifier corresponding to the data processing request according to the relative position of the data processing request in the request cache queue when there is a waiting task for the data processing request, and write the waiting task and the request identifier into the waiting queue accordingly. The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
[0168] In one embodiment, the apparatus further comprises:
[0169] A result determination module is used for, for each of the target data processing requests, when a request response corresponding to the target data processing request is detected, calling a target interface according to an interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request;
[0170] A waiting detection module, used for determining whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue;
[0171] The trigger determination module is used to determine whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue if the target waiting task exists.
[0172] In one embodiment, the trigger determination module includes:
[0173] A dependency unit, configured to extract the target waiting task from the waiting queue according to the target request identifier if the request type of the target data processing request is a dependent request type and a request response corresponding to a dependent data processing request having a dependent relationship with the target data processing request is detected;
[0174] The first triggering unit is used to trigger the target waiting task according to the request processing result and the dependent request processing results corresponding to each dependent data processing request.
[0175] In one embodiment, the trigger determination module includes:
[0176] a non-dependent unit, configured to extract the target waiting task from the waiting queue according to the target request identifier if the request type of the target data processing request is a non-dependent request type;
[0177] The second triggering unit is used to trigger the target waiting task according to the request processing result.
[0178] In one embodiment, the request queue transfer condition includes at least one of executing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching a transfer time corresponding to a request queue transfer cycle at a current time.
[0179] In one embodiment, the response module 1003 includes:
[0180] A position acquisition unit, used for acquiring a disk access position corresponding to each target data processing request;
[0181] A sorting unit, used to determine the sorting order of each of the target data processing requests according to each of the disk access positions;
[0182] A sequential response unit is used to respond to each of the target data processing requests according to the sorting order.
[0183] Each module in the above request processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0184] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.11 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store request processing data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a request processing method is implemented.
[0185] Those skilled in the art will understand that Fig.11The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0186] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0187] When the request queue transfer condition is met, extracting the data processing request from the request cache queue and writing the data processing request into the request processing queue;
[0188] Obtaining queue parameters of the request processing queue, and extracting target data processing requests from the request processing queue according to the queue parameters;
[0189] Respond to the target data processing request.
[0190] In one embodiment, the queue parameter includes a queue length of the request processing queue, and the processor further implements the following steps when executing the computer program:
[0191] Detecting whether the queue length is greater than a preset aggregation length, and obtaining a detection result;
[0192] According to the detection result, the target data processing request is extracted from the request processing queue.
[0193] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0194] If the detection result is that the queue length is greater than or equal to the preset aggregation length, the target data processing request is extracted from the request processing queue according to the number of requests corresponding to the preset aggregation length.
[0195] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0196] If the detection result is that the queue length is less than the preset aggregation length, and the queue length is less than the preset non-aggregation length, then detecting whether the time difference between the time when the last data processing request was written in the request processing queue and the current time is greater than the waiting time threshold, and the preset non-aggregation length is less than the preset aggregation length;
[0197] If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue, and all the data processing requests are used as the target data processing requests.
[0198] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0199] Writing the received data processing request into the request cache queue;
[0200] In the case that there is a waiting task for the data processing request, the request identifier corresponding to the data processing request is determined according to the relative position of the data processing request in the request cache queue, and the waiting task and the request identifier are written into the waiting queue corresponding to each other. The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
[0201] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0202] For each of the target data processing requests, when a request response corresponding to the target data processing request is detected, a target interface is called according to the interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request;
[0203] Determine whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue;
[0204] If the target waiting task exists, it is determined whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue.
[0205] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0206] If the request type of the target data processing request is a dependent request type, and a request response corresponding to a dependent data processing request having a dependent relationship with the target data processing request is detected, extracting the target waiting task from the waiting queue according to the target request identifier;
[0207] The target waiting task is triggered according to the request processing result and the dependent request processing results corresponding to each dependent data processing request.
[0208] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0209] If the request type of the target data processing request is a non-dependent request type, extracting the target waiting task from the waiting queue according to the target request identifier;
[0210] According to the request processing result, the target waiting task is triggered.
[0211] In one embodiment, the request queue transfer condition includes at least one of executing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching a transfer time corresponding to a request queue transfer cycle at a current time.
[0212] In one embodiment, the number of the target data processing requests is multiple, and the processor further implements the following steps when executing the computer program:
[0213] Obtaining a disk access location corresponding to each of the target data processing requests;
[0214] Determining a sorting order of each of the target data processing requests according to each of the disk access positions;
[0215] Each of the target data processing requests is responded to according to the sorting order.
[0216] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0217] When the request queue transfer condition is met, extracting the data processing request from the request cache queue and writing the data processing request into the request processing queue;
[0218] Obtaining queue parameters of the request processing queue, and extracting target data processing requests from the request processing queue according to the queue parameters;
[0219] Respond to the target data processing request.
[0220] In one embodiment, the queue parameter includes a queue length of the request processing queue, and the computer program, when executed by a processor, further implements the following steps:
[0221] Detecting whether the queue length is greater than a preset aggregation length, and obtaining a detection result;
[0222] According to the detection result, the target data processing request is extracted from the request processing queue.
[0223] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0224] If the detection result is that the queue length is greater than or equal to the preset aggregation length, the target data processing request is extracted from the request processing queue according to the number of requests corresponding to the preset aggregation length.
[0225] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0226] If the detection result is that the queue length is less than the preset aggregation length, and the queue length is less than the preset non-aggregation length, then detecting whether the time difference between the time when the last data processing request was written in the request processing queue and the current time is greater than the waiting time threshold, and the preset non-aggregation length is less than the preset aggregation length;
[0227] If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue, and all the data processing requests are used as the target data processing requests.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0229] Writing the received data processing request into the request cache queue;
[0230] In the case that there is a waiting task for the data processing request, the request identifier corresponding to the data processing request is determined according to the relative position of the data processing request in the request cache queue, and the waiting task and the request identifier are written into the waiting queue corresponding to each other. The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
[0231] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0232] For each of the target data processing requests, when a request response corresponding to the target data processing request is detected, a target interface is called according to the interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request;
[0233] Determine whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue;
[0234] If the target waiting task exists, it is determined whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue.
[0235] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0236] If the request type of the target data processing request is a dependent request type, and a request response corresponding to a dependent data processing request having a dependent relationship with the target data processing request is detected, extracting the target waiting task from the waiting queue according to the target request identifier;
[0237] The target waiting task is triggered according to the request processing result and the dependent request processing results corresponding to each dependent data processing request.
[0238] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0239] If the request type of the target data processing request is a non-dependent request type, extracting the target waiting task from the waiting queue according to the target request identifier;
[0240] According to the request processing result, the target waiting task is triggered.
[0241] In one embodiment, the request queue transfer condition includes at least one of executing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching a transfer time corresponding to a request queue transfer cycle at a current time.
[0242] In one embodiment, the number of the target data processing requests is multiple, and when the computer program is executed by the processor, the following steps are further implemented:
[0243] Obtaining a disk access location corresponding to each of the target data processing requests;
[0244] Determining a sorting order of each of the target data processing requests according to each of the disk access positions;
[0245] Each of the target data processing requests is responded to according to the sorting order.
[0246] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0247] When the request queue transfer condition is met, extracting the data processing request from the request cache queue and writing the data processing request into the request processing queue;
[0248] Obtaining queue parameters of the request processing queue, and extracting target data processing requests from the request processing queue according to the queue parameters;
[0249] Respond to the target data processing request.
[0250] In one embodiment, the queue parameter includes a queue length of the request processing queue, and the computer program, when executed by a processor, further implements the following steps:
[0251] Detecting whether the queue length is greater than a preset aggregation length, and obtaining a detection result;
[0252] According to the detection result, the target data processing request is extracted from the request processing queue.
[0253] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0254] If the detection result is that the queue length is greater than or equal to the preset aggregation length, the target data processing request is extracted from the request processing queue according to the number of requests corresponding to the preset aggregation length.
[0255] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0256] If the detection result is that the queue length is less than the preset aggregation length, and the queue length is less than the preset non-aggregation length, then detecting whether the time difference between the time when the last data processing request was written in the request processing queue and the current time is greater than the waiting time threshold, and the preset non-aggregation length is less than the preset aggregation length;
[0257] If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue, and all the data processing requests are used as the target data processing requests.
[0258] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0259] Writing the received data processing request into the request cache queue;
[0260] In the case that there is a waiting task for the data processing request, the request identifier corresponding to the data processing request is determined according to the relative position of the data processing request in the request cache queue, and the waiting task and the request identifier are written into the waiting queue corresponding to each other. The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
[0261] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0262] For each of the target data processing requests, when a request response corresponding to the target data processing request is detected, a target interface is called according to the interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request;
[0263] Determine whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue;
[0264] If the target waiting task exists, it is determined whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue.
[0265] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0266] If the request type of the target data processing request is a dependent request type, and a request response corresponding to a dependent data processing request having a dependent relationship with the target data processing request is detected, extracting the target waiting task from the waiting queue according to the target request identifier;
[0267] The target waiting task is triggered according to the request processing result and the dependent request processing results corresponding to each dependent data processing request.
[0268] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0269] If the request type of the target data processing request is a non-dependent request type, extracting the target waiting task from the waiting queue according to the target request identifier;
[0270] According to the request processing result, the target waiting task is triggered.
[0271] In one embodiment, the request queue transfer condition includes at least one of executing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching a transfer time corresponding to a request queue transfer cycle at a current time.
[0272] In one embodiment, the number of the target data processing requests is multiple, and when the computer program is executed by the processor, the following steps are further implemented:
[0273] Obtaining a disk access location corresponding to each of the target data processing requests;
[0274] Determining a sorting order of each of the target data processing requests according to each of the disk access positions;
[0275] Each of the target data processing requests is responded to according to the sorting order.
[0276] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0277] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0278] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0279] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A request processing method, characterized in that: The method comprises: When the request queue transfer condition is met, extracting the data processing request from the request cache queue and writing the data processing request into the request processing queue; Obtaining queue parameters of the request processing queue, and extracting target data processing requests from the request processing queue according to the queue parameters; Respond to the target data processing request.
2. The method according to claim 1, characterized in that The queue parameter includes a queue length of the request processing queue, and extracting the target data processing request from the request processing queue according to the queue parameter includes: Detecting whether the queue length is greater than a preset aggregation length, and obtaining a detection result; According to the detection result, the target data processing request is extracted from the request processing queue.
3. The method according to claim 2, characterized in that The extracting the target data processing request from the request processing queue according to the detection result includes: If the detection result is that the queue length is greater than or equal to the preset aggregation length, the target data processing request is extracted from the request processing queue according to the number of requests corresponding to the preset aggregation length.
4. The method according to claim 3, characterized in that The method further comprises: If the detection result is that the queue length is less than the preset aggregation length, and the queue length is less than the preset non-aggregation length, then detecting whether the time difference between the time when the last data processing request was written in the request processing queue and the current time is greater than the waiting time threshold, and the preset non-aggregation length is less than the preset aggregation length; If the time difference is greater than or equal to the waiting time threshold, all data processing requests are extracted from the request processing queue, and all the data processing requests are used as the target data processing requests.
5. The method according to any one of claims 1 to 4, characterized in that: Before extracting the data processing request from the request cache queue, the method further includes: Writing the received data processing request into the request cache queue; In the case that there is a waiting task for the data processing request, the request identifier corresponding to the data processing request is determined according to the relative position of the data processing request in the request cache queue, and the waiting task and the request identifier are written into the waiting queue corresponding to each other. The waiting queue is used to trigger the execution of the waiting task based on the request processing result of the data processing request.
6. The method according to claim 5, characterized in that The method further comprises: For each of the target data processing requests, when a request response corresponding to the target data processing request is detected, a target interface is called according to the interface field included in the target data processing request to obtain a request processing result corresponding to the target data processing request; Determine whether there is a target waiting task for the target data processing request according to the target request identifier corresponding to the target data processing request and the waiting queue; If the target waiting task exists, it is determined whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue.
7. The method according to claim 6, characterized in that The determining whether to trigger the target waiting task according to the request processing result, the target request identifier and the waiting queue includes: If the request type of the target data processing request is a dependent request type, and a request response corresponding to a dependent data processing request having a dependent relationship with the target data processing request is detected, extracting the target waiting task from the waiting queue according to the target request identifier; The target waiting task is triggered according to the request processing result and the dependent request processing results corresponding to each dependent data processing request.
8. The method according to claim 7, characterized in that The method further comprises: If the request type of the target data processing request is a non-dependent request type, extracting the target waiting task from the waiting queue according to the target request identifier; According to the request processing result, the target waiting task is triggered.
9. The method according to claim 1, characterized in that: The request queue transfer condition includes at least one of executing an enqueue operation on the request cache queue, detecting a request response corresponding to any data processing request in the request processing queue, and reaching a transfer time corresponding to a request queue transfer cycle at a current time.
10. The method according to claim 1, characterized in that The number of the target data processing requests is multiple, and the responding to the target data processing requests includes: Obtaining a disk access location corresponding to each of the target data processing requests; Determining a sorting order of each of the target data processing requests according to each of the disk access positions; Each of the target data processing requests is responded to according to the sorting order.
11. A request processing device, characterized in that: The device comprises: A processing module, configured to extract a data processing request from a request cache queue and write the data processing request into a request processing queue when a request queue transfer condition is met; an acquisition module, used for acquiring queue parameters of the request processing queue, and extracting target data processing requests from the request processing queue according to the queue parameters; A response module is used to respond to the target data processing request.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.