CN115495312B - Service request processing method and device - Google Patents

Service request processing method and device Download PDF

Info

Publication number
CN115495312B
CN115495312B CN202211182518.2A CN202211182518A CN115495312B CN 115495312 B CN115495312 B CN 115495312B CN 202211182518 A CN202211182518 A CN 202211182518A CN 115495312 B CN115495312 B CN 115495312B
Authority
CN
China
Prior art keywords
preprocessing
memory space
processing
processor
service request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211182518.2A
Other languages
Chinese (zh)
Other versions
CN115495312A (en
Inventor
钱洋
钱正宇
施恩
胡鸣人
袁正雄
李金麒
褚振方
黄悦
王国彬
罗阳
王宽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing 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 CN202211182518.2A priority Critical patent/CN115495312B/en
Publication of CN115495312A publication Critical patent/CN115495312A/en
Application granted granted Critical
Publication of CN115495312B publication Critical patent/CN115495312B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3037Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a memory, e.g. virtual memory, cache
    • 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/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The disclosure provides a service request processing method and device, relates to the technical field of artificial intelligence, and particularly relates to the technical field of data processing and machine learning. The specific implementation scheme is as follows: preprocessing a received first service request, writing preprocessed data obtained by preprocessing into a first memory space, if the second service request is received before the processing result of the second processor on the preprocessed data in a second memory space is monitored, continuing to preprocess the second service request, and carrying out post-processing on the processing result in the second memory space to obtain a corresponding request result when the processing result of the second processor on the preprocessed data in the second memory space is monitored. Thereby, the utilization of computing resources is improved.

Description

Service request processing method and device
Technical Field
The disclosure relates to the technical field of artificial intelligence, in particular to the technical field of data processing and machine learning, and particularly relates to a service request processing method and device.
Background
With the development of internet technology, a service requester may obtain a corresponding request result by sending a service request to a service provider.
In the related art, in order to provide a better request result for a service requester, a service provider generally performs preprocessing on service data to be processed in a service request, performs corresponding processing on the preprocessed data, and performs post-processing on a processing result after corresponding processing. For example, the service requester may obtain a corresponding voice-to-text result by sending a voice-to-text request, and in order to improve the readability and understandability of the request result, the service provider typically performs preprocessing such as denoising on the voice to be converted in the voice-to-text request, and performs voice recognition on the preprocessed voice to obtain a corresponding text, and performs post-processing such as text error correction and punctuation prediction on the text to obtain the corresponding request result.
For a service provider, how to fully utilize computing resources in the service provider is important for the service provider.
Disclosure of Invention
The present disclosure provides a service request processing method, apparatus, electronic device, storage medium, and computer program product.
According to a first aspect of the present disclosure, there is provided a service request processing method, applied to a first processor, the method including: preprocessing a received first service request, writing preprocessed data obtained by preprocessing into a first memory space, wherein the preprocessed data in the first memory space is used for indicating a second processor to perform target processing on the preprocessed data, and writing a processing result into the second memory space; when the second processor monitors that the processing result of the preprocessing data exists in the second memory space, post-processing is carried out on the processing result in the second memory space so as to obtain a corresponding request result; and preprocessing the second service request before the second processor monitors that the processing result of the preprocessed data exists in the second memory space and under the condition that the second service request is received.
According to a second aspect of the present disclosure, a service request processing method is provided, applied to a second processor, and in case that first preprocessing data exists in a first memory space, performing target processing on the first preprocessing data, where the first preprocessing data is written into the first memory space by a first processor, and the first preprocessing data is obtained by preprocessing a received first service request by the first processor; writing a processing result obtained through target processing into a second memory space, wherein the processing result in the second memory space is used for indicating the first processor to perform post-processing on the processing result in the second memory space so as to obtain a corresponding request result; and under the condition that second preprocessing data exist in the first memory space, performing target processing on the second preprocessing data, wherein the second preprocessing data are obtained by preprocessing a received second service request by the first processor, and the second service request is received by the first processor before the first processor monitors that the processing result exists in the second memory space.
According to a third aspect of the present disclosure, there is provided a service request processing apparatus applied to a first processor, the apparatus comprising: the first preprocessing module is used for preprocessing a received first service request, writing preprocessed data obtained by preprocessing into a first memory space, wherein the preprocessed data in the first memory space are used for indicating a second processor to perform target processing on the preprocessed data, and writing a processing result into the second memory space; the post-processing module is used for carrying out post-processing on the processing result in the second memory space to obtain a corresponding request result when the processing result of the second processor on the preprocessing data is monitored to exist in the second memory space; and the second preprocessing module is used for preprocessing the second service request before the second processor monitors that the processing result of the preprocessed data exists in the second memory space and under the condition that the second service request is received.
According to a fourth aspect of the present disclosure, there is provided a service request processing apparatus applied to a second processor, the apparatus comprising: the first processing module is used for performing target processing on first preprocessing data under the condition that the first preprocessing data exist in a first memory space is monitored, wherein the first preprocessing data are written into the first memory space by a first processor, and the first preprocessing data are obtained by preprocessing a received first service request by the first processor; the writing module is used for writing the processing result obtained through target processing into a second memory space, wherein the processing result in the second memory space is used for indicating the first processor to perform post-processing on the processing result in the second memory space so as to obtain a corresponding request result; and the second processing module is used for carrying out target processing on the second preprocessing data under the condition that the second preprocessing data exist in the first memory space is monitored, wherein the second preprocessing data are obtained by preprocessing a received second service request by the first processor, and the second service request is received by the first processor before the first processor monitors that the processing result exists in the second memory space.
According to a fifth aspect of the present disclosure, there is provided a service request processing system, including: a first processor and a second processor, where the first processor is configured to execute the service request processing method provided in the first aspect; the second processor is configured to execute the service request processing method provided in the second aspect.
According to a sixth aspect of the present disclosure, there is provided an electronic device, wherein the electronic device comprises 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 service request processing method provided in the first aspect or to perform the service request processing method provided in the second aspect.
According to a seventh aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program, including a program which, when executed by a processor, implements the service request processing method provided in the first aspect as described above, or the service request processing method provided in the second aspect as described above.
According to an eighth aspect of the present disclosure, there is provided a computer program product which when executed by an instruction processor in the computer program product implements the service request processing method as provided in the first aspect or the service request processing method as provided in the second aspect.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure;
FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure;
FIG. 3 is a schematic diagram according to a third embodiment of the present disclosure;
FIG. 4 is a schematic diagram according to a fourth embodiment of the present disclosure;
FIG. 5 is a schematic diagram according to a fifth embodiment of the present disclosure;
FIG. 6 is a schematic diagram according to a sixth embodiment of the present disclosure;
FIG. 7 is a schematic diagram according to a seventh embodiment of the present disclosure;
FIG. 8 is an exemplary diagram of a relationship between a first process, a second process, a first memory space, and a second memory space provided in accordance with an embodiment of the present disclosure;
FIG. 9 is a schematic diagram according to an eighth embodiment of the present disclosure;
FIG. 10 is a schematic diagram according to a ninth embodiment of the present disclosure;
FIG. 11 is a schematic diagram according to a tenth embodiment of the present disclosure;
FIG. 12 is a schematic diagram according to an eleventh embodiment of the present disclosure;
FIG. 13 is a schematic illustration according to a twelfth embodiment of the disclosure;
fig. 14 is a schematic block diagram of an electronic device provided in an embodiment of the disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one 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 and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Currently, with the development of artificial intelligence technology, an artificial intelligence model is generally used to perform corresponding target processing on preprocessed data, for example, performing speech recognition on preprocessed speech through a speech recognition model. Since the artificial intelligence model is composed of a large number of operations that are computationally intensive, the related art performs preprocessing and post-processing in a CPU and performs object processing in a GPU, for example, performs speech recognition on the preprocessed speech by calling a speech conversion model in the GPU, based on a synchronization framework, in a manner that the first processor (for example, the first processor is a central processor (Central Processing Unit, CPU))/the second processor (for example, the second processor is a graphics processor (Graphics Processing Unit, GPU)). However, in the process of processing a plurality of service requests based on the synchronization method, it is common to perform preprocessing, target processing, and post-processing on one service request, and then perform preprocessing, target processing, and post-processing on another service request. However, in this way, in the process of performing target processing on the preprocessing data corresponding to one service request by the GPU, the computing resources on the CPU are in an idle state, and the computing resources are not fully utilized, thereby causing the waste of the computing resources on the CPU.
Therefore, in the service request processing method provided by the embodiment of the disclosure, the received first service request is preprocessed, the preprocessed data obtained by preprocessing is written into the first memory space, if the second service request is received before the processing result of the second processor on the preprocessed data is monitored in the second memory space, the second service request is preprocessed continuously, and under the condition that the processing result of the second processor on the preprocessed data is monitored in the second memory space, the processing result in the second memory space is processed post-to obtain the corresponding request result. Therefore, the first processor can preprocess the received second service request before the first processor monitors the processing result of the second processor on the preprocessing data in the second memory space, so that the first processor is prevented from being in an idle state under the condition that the first processor monitors the processing result in the second memory space, and the utilization rate of computing resources of the first processor is improved.
The service request processing method, the service request processing device and the electronic equipment provided by the embodiment of the disclosure are described below with reference to the accompanying drawings.
Fig. 1 is a schematic diagram according to a first embodiment of the present disclosure.
As shown in fig. 1, the service request processing method includes the following steps:
step 101, preprocessing the received first service request, and writing preprocessed data obtained by preprocessing into a first memory space.
The preprocessing data in the first memory space is used for indicating the second processor to perform target processing on the preprocessing data, and the processing result is written into the second memory space.
It should be noted that, the service request processing method provided in the embodiment of the present disclosure is applied to a service request processing device, where the service request processing device may be implemented by software and/or hardware, and the service request processing device may be a first processor or may be configured in the first processor.
The first processor may be a central processor or other processors capable of performing preprocessing and post-processing by using the service request processing method provided by the embodiment of the present disclosure, which is not limited in this disclosure. In this embodiment, the first processor is taken as a central processing unit for illustration.
The second processor in this exemplary embodiment is a processor different from the first processor, and the second processor may be a graphics processor or other processor capable of performing target processing on the preprocessed data, which is not limited by this disclosure. In this embodiment, the second processor is taken as a GPU of a graphics processor as an example.
The first service request is a request sent to a service request processing device when a service requester needs to obtain a processing result of first data to be processed.
It will be appreciated that in different application scenarios, the first data to be processed is different, and the target processing that needs to be performed on the first data to be processed is also different. For example, in an image word recognition scenario, the first data to be processed may be an image to be processed, in which scenario the corresponding target processing may be word recognition processing, and correspondingly, the word recognition processing may be performed on the preprocessed image by the word recognition model. For another example, in a scenario where the service requester needs to learn a sky area in a certain image, the first data to be processed may be the image to be processed, and correspondingly, the target process may be sky area prediction processing, and in some examples, the sky area prediction processing may be performed on the image to be processed through a sky area prediction model.
The first memory space and the second memory space in this example may be the same or different, and the embodiment is not limited in particular.
In other exemplary embodiments, after the first processor writes the pre-processed data into the first memory space, if the second processor monitors that the pre-processed data exists in the first memory space, the second processor may acquire an unprocessed pre-processed data from the first memory space, perform a target process on the acquired pre-processed data, and write a processing result obtained by the target process into the second memory space.
Step 102, under the condition that the processing result of the second processor on the preprocessed data exists in the second memory space, post-processing is performed on the processing result in the second memory space to obtain a corresponding request result.
Among other things, it can be appreciated that the present example post-processes the processing results differently in different application scenarios.
In order to clearly understand the present disclosure, an example will be described below in which a service request is taken as an example in which a service requester needs to acquire a text recognition result of an image, in this example, a pre-processing such as denoising may be performed on an image to be processed in the service request, and a pre-processed image obtained by the pre-processing is input into a first memory space, and correspondingly, if the second processor monitors that the pre-processed image exists in the first memory space, the second processor may perform text recognition on the pre-processed image based on a text recognition model (i.e., in this example, the target process is text recognition), and write a text recognition result obtained by the text recognition into the second memory space. Correspondingly, under the condition that the first processor monitors that the character recognition result exists in the second memory space, the first processor can perform post-processing such as text error correction and punctuation prediction on the character recognition result to obtain a corresponding request result, and returns the corresponding request result to the service requester so that the service requester can know text content corresponding to the image to be processed.
Step 103, preprocessing the second service request before hearing that the second processor processes the preprocessed data in the second memory space, and under the condition that the second service request is received.
That is, before the first processor in this example monitors that the second memory space has a processing result of the second processor on the preprocessed data, if the first processor receives the second service request, the first processor may preprocess the received second service request, so that the first processor in an idle state is avoided when the first processor monitors that the second memory space does not have a processing result, so that the first processor in an idle state may continue to preprocess the second service request, fully utilize computing resources on the first processor, and improve the utilization rate of computing resources of the first processor.
The second service request is a request sent to the service request processing device when the service requester needs to obtain a processing result of the second data to be processed.
In this example, the service requesters corresponding to the first service request and the second service request may be the same or different, and the embodiment is not specifically limited.
The second to-be-processed data in this example may be different from the first to-be-processed data, for example, in an image text recognition scenario, the first to-be-processed data may be a first to-be-processed image, the second to-be-processed data may be a second to-be-processed image, and the first to-be-processed image and the second to-be-processed image are different.
Based on the foregoing, it can be seen that in this exemplary embodiment, when a service request is processed, instead of processing one service request after preprocessing, target processing, and post-processing, another service request is processed, after preprocessing one service request, if the first processor monitors that there is no processing result corresponding to the service request in the second memory space, the first processor may directly preprocess the received other service request. That is, in this example, the plurality of service requests are not processed in a synchronous manner, but are processed in an asynchronous manner, so that the first processor is prevented from being in an idle state in the process of performing target processing on the preprocessed data by the second processor, and the waste of computing resources of the first processor is avoided.
According to the service request processing method provided by the embodiment of the disclosure, the received first service request is preprocessed, preprocessed data obtained by preprocessing is written into the first memory space, if the second service request is received before the processing result of the second processor on the preprocessed data is monitored in the second memory space, the second service request is preprocessed continuously, and under the condition that the processing result of the second processor on the preprocessed data is monitored in the second memory space, the processing result in the second memory space is processed post-to obtain the corresponding request result. Therefore, the first processor can preprocess the received second service request before monitoring that the second processor processes the preprocessing data in the second memory space, and the utilization rate of computing resources is improved.
In an embodiment of the present disclosure, in the case that the number of first service requests is multiple, in order to make full use of computing resources on the first processor, preprocessing of the multiple first service requests is performed by the multiple first processes, and in order to clearly understand how to preprocess service requests in the service request set based on the multiple first processes, another service request processing method is provided in this embodiment. Another service request processing method is exemplarily described below with reference to fig. 2.
Fig. 2 is a schematic diagram according to a second embodiment of the present disclosure.
As shown in fig. 2, the service request processing method includes the steps of:
in step 201, a plurality of first service requests are received.
Step 202, for each first process: a first service request which is not preprocessed is obtained from a plurality of first service requests.
Step 203, call the first process, preprocess the obtained first service request, and write the preprocessed data obtained by preprocessing into the first memory space.
Step 204, obtaining the next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed.
Correspondingly, the second processor can perform target processing on the preprocessed data under the condition that the second processor monitors that the corresponding preprocessed data exists in the first memory space, and write a processing result obtained by the target processing into the second memory space.
It can be understood that, in the case that a plurality of pieces of preprocessed data exist in the first memory space, in order to further improve the computing resource of the first processor, the first processor is prevented from being in an idle state, the utilization rate of the computing resource is improved, and correspondingly, the second processor can process the plurality of pieces of preprocessed data existing in the first memory space through a plurality of second processes respectively. For each second process, unprocessed pretreatment data can be obtained from the first memory space for target processing, next unprocessed pretreatment data is obtained from the first memory space, and the second process continues to target processing on the obtained pretreatment data until the pretreatment data in the first memory space is completely target processed.
In step 205, if it is monitored that the second processor processes the pre-processed data in the second memory space, post-processing is performed on the processed result in the second memory space to obtain a corresponding request result.
It should be noted that, regarding the specific implementation of step 205, reference may be made to the related description of the embodiments of the present disclosure, which is not repeated here.
Step 206, preprocessing the second service request before hearing that the second processor processes the preprocessed data in the second memory space, and in case of receiving the second service request.
In one embodiment of the present disclosure, in order to further improve the utilization ratio of the computing resource of the first processor, to avoid that the computing resource of the first processor is in an idle state, before a processing result of the second processor on the preprocessed data is monitored in the second memory space, and in case of receiving the second service request, a target process in the idle state may be obtained from a plurality of first processes; and preprocessing the second service request through the target process.
Wherein the second service request in this example may be one or more, and the embodiment is not particularly limited thereto.
Correspondingly, if the number of the target processes is multiple in the case that the second service requests are multiple, acquiring one second service request which is not preprocessed from the multiple second service requests for each target process; invoking the target process, preprocessing the acquired second service request, and writing preprocessed data obtained by preprocessing into the first memory space; and acquiring a second service request which is not preprocessed from the plurality of second service requests, and continuing preprocessing the second service request which is not preprocessed by the target process until the plurality of second service requests are preprocessed. Therefore, the plurality of second service requests are preprocessed based on the synchronization of the plurality of target processes in the idle state, so that the computing resources on the first processor can be fully utilized, and the utilization rate of the computing resources on the first processor is improved.
In the exemplary embodiment of the disclosure, in the process of preprocessing the plurality of first service requests, the plurality of first processes are invoked to preprocess the plurality of first service requests, so that the efficiency of preprocessing the service requests by the first processor can be improved, the computing resources on the first processor are further fully utilized, and the utilization rate of the computing resources of the first processor is improved.
In one embodiment of the present disclosure, in the case where the second processor performs the target processing on the preprocessing data in the first memory space through the at least one second process, in order for the first processor not to block the waiting processing result, the computing resources on the first processor may be fully utilized, and in some examples, the second number of the first processes may be determined in combination with the execution time of executing the preprocessing, the execution time of executing the target processing, and the first number of the second processes on the second processor, and the second number of the first processes may be created. In order that the procedure may be made clear, an exemplary description of a service request processing method is described below in connection with fig. 3.
Fig. 3 is a schematic diagram according to a third embodiment of the present disclosure.
As shown in fig. 3, the service request processing method includes the steps of:
step 301, determining a first execution time consuming for performing the preprocessing, and determining a second execution time consuming for performing the target processing.
In some exemplary embodiments, a plurality of historical execution times for performing the preprocessing may be obtained and averaged to obtain a first execution time for performing the preprocessing.
In some example embodiments, a plurality of historical execution times for performing the target process may be obtained and averaged to obtain a second execution time for performing the target process.
Step 302, determining a second number of first processes to be created according to the first execution time, the second execution time, and the first number of the plurality of second processes.
It will be appreciated that in different application scenarios, the implementation of determining the second number of the first processes to be created is different according to the first execution time, the second execution time and the first number of the plurality of second processes, and the following is an exemplary description:
as an example, based on the correspondence between the pre-saved first execution time consumption, the second execution time consumption, the number of the plurality of second processes, and the number of the first processes, the number corresponding to the first execution time consumption, the second execution time consumption, and the first number of the plurality of second processes may be determined, and the determined number may be used as the second number of the first processes to be created.
As another example, the first execution time, the second execution time, and the first number of the plurality of second processes may be input into a pre-established computing function to obtain the second number of first processes to be created through the computing function.
As another example, a ratio of the first execution time consumption and the second execution time consumption may be determined, and a second number of first processes to be created may be determined based on the ratio and the first number of the plurality of second processes. Thus, the second number of first processes to be created can be accurately determined.
It can be appreciated that, in different application scenarios, the implementation manner of determining the second number of the first processes to be created is different according to the ratio and the first number of the at least one second process, and the exemplary description is as follows:
in some exemplary embodiments, the ratio and the first process may be input into a preset calculation function to obtain the second number of the first processes to be created through the calculation function.
In other exemplary embodiments, the number matching the ratio and the first number may be obtained from a pre-stored correspondence, and the obtained number is the second number of the first process to be created.
It can be understood that the correspondence relationship among the ratio, the number of the first processes, and the number of the second processes is pre-stored in the correspondence relationship.
In other exemplary embodiments, the comparison value and the preset value may be summed to obtain a summed value; the sum value is multiplied by a first number of the plurality of second processes to obtain a second number of first processes to be created. Thereby, the second number of first processes to be created can be further accurately determined.
The preset value is preset according to actual requirements, for example, the preset value may be 1.
As an example, in the case where the preset value is 1, the formula for calculating the second number Y of the first processes to be created is:
wherein A in the formula represents a first execution time consuming; b in the formula represents the second execution time consuming,representing the ratio of the first execution time and the second execution time, C representing the first number.
In some exemplary embodiments, in order to accurately determine the number of first processes that need to be created by the first processor, after multiplying the sum value and the first number of the plurality of second processes to obtain a product value, the product value may be rounded up, and a value obtained by rounding up may be taken as the number of first processes to be created.
Step 303, a second number of first processes is created.
In one embodiment of the present disclosure, for each first process, in order for each first process to have enough process resources to pre-process the corresponding service request, the execution complexity of performing the pre-processing may be determined; and according to the execution complexity, corresponding process resources are allocated for the first process.
The process resources refer to various resources required by the first process when preprocessing the corresponding service request.
Wherein, the execution complexity refers to a standard for evaluating the difficulty of executing the preprocessing. In some examples, the execution complexity may be specifically the resources required to perform the preprocessing, such as the time and memory resources required to perform the preprocessing, and the like. It should be noted that, the time required for executing the preprocessing is time consuming for executing the preprocessing.
In an exemplary embodiment, the execution time of the preprocessing may be obtained, the memory resource occupied by the preprocessing may be determined, and the execution complexity of the preprocessing may be determined according to the memory resource and the execution time.
In this example, based on the execution complexity of executing the preprocessing, corresponding process resources are adaptively allocated to the first process, so that automatic allocation of the process resources is realized, the allocated process resources can meet the requirement of executing the preprocessing, and accuracy of process resource allocation is improved.
Step 304, preprocessing the received first service request, and writing the preprocessed data obtained by preprocessing into the first memory space.
The preprocessing data in the first memory space is used for indicating the second processor to perform target processing on the preprocessing data, and the processing result is written into the second memory space.
Step 305, for each first process: a first service request which is not preprocessed is obtained from a plurality of first service requests.
Step 306, the first process is invoked, the obtained first service request is preprocessed, and preprocessed data obtained through preprocessing is written into the first memory space.
Step 307, obtaining the next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed.
Step 308, in case that the second processor monitors the processing result of the pre-processed data in the second memory space, post-processing is performed on the processing result in the second memory space to obtain a corresponding request result.
Step 309, preprocessing the second service request before hearing that the second processor processes the preprocessed data in the second memory space, and in case that the second service request is received.
For specific implementation manners of steps 304 to 309, reference may be made to related descriptions of implementations of the disclosure, which are not repeated here.
In this example, the second number of first processes to be created on the first processor is determined in combination with the first execution time for executing the preprocessing, the second execution time for executing the target processing, and the first number of second processes on the second processor, and the second number of first processes are created, so that the service request can be preprocessed by the created first processes, the computing resources on the first processor are further fully utilized, the first processor is prevented from being in an idle state, and the utilization rate of the computing resources on the first processor is improved.
Based on any of the above embodiments, in order to make full use of computing resources on the first processor to post-process the processing results in the second memory space, in some examples, the first process may also be used to perform post-processing. In order to clearly understand how to perform post-processing on the processing result in the second memory space based on the first process to obtain the corresponding process of the request result, the embodiment of the present disclosure further provides a service request processing method, and the service request processing method is described in an exemplary manner below with reference to fig. 4.
Fig. 4 is a schematic diagram according to a fourth embodiment of the present disclosure.
As shown in fig. 4, the service request processing method includes the steps of:
in step 401, a plurality of first service requests are received.
Step 402, for each first process: a first service request which is not preprocessed is obtained from a plurality of first service requests.
Step 403, invoking the first process, preprocessing the acquired first service request, and writing the process identifier of the first process and the preprocessed data obtained by preprocessing into the first memory space correspondingly.
Step 404, under the condition that the processing result of the preprocessing data corresponding to the process identifier of the first process does not exist in the second memory space, acquiring a next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed.
Step 405, when it is monitored that the second memory space has a processing result of the pre-processing data corresponding to the process identifier of the first process, the first process is invoked, and post-processing is performed on the processing result, so as to obtain a corresponding request result.
In step 406, the processing result of the preprocessing data corresponding to the process identifier of the first process does not exist in the second memory space is monitored, the preprocessing is completed for the plurality of first service requests, and the preprocessing is performed for the second service request through the first process under the condition that the second service request is received.
In this example embodiment, by invoking a plurality of first processes to perform post-processing on the processing result in the second memory space, the efficiency of the first processor in performing post-processing on the processing result can be improved, and the computing resource on the first processor is further fully utilized.
Fig. 5 is a schematic diagram according to a fifth embodiment of the present disclosure.
As shown in fig. 5, the service request processing method includes the steps of:
in step 501, if it is monitored that the first preprocessing data exists in the first memory space, target processing is performed on the first preprocessing data, where the first preprocessing data is written into the first memory space by the first processor, and the first preprocessing data is obtained by preprocessing a received first service request by the first processor.
It should be noted that, the service request processing method provided in the embodiment of the present disclosure is applied to a service request processing device, where the service request processing device may be implemented by software and/or hardware, and the service request processing device may be a second processor or configured in the second processor.
The second processor may be a graphics processor or other processor capable of performing target processing on the preprocessed data, which is not limited by the present disclosure. It should be noted that, in the embodiment of the present disclosure, the second processor is taken as an example of a graphics processor.
In some examples, where the preprocessed data is present in the first memory space, the second processor may obtain unprocessed preprocessed data from the first memory space and perform target processing on the preprocessed data to obtain a processing result.
Step 502, writing the processing result obtained by the target processing into a second memory space, where the processing result in the second memory space is used to instruct the first processor to perform post-processing on the processing result in the second memory space, so as to obtain a corresponding request result.
In step 503, if it is monitored that the second pre-processing data exists in the first memory space, the target processing is performed on the second pre-processing data, where the second pre-processing data is obtained by the first processor pre-processing the received second service request, where the second service request is received by the first processor before it is monitored that the processing result exists in the second memory space.
It can be understood that, in the related art, since the first processor does not post-process the processing result of the corresponding service request, and does not write the processing data corresponding to the next service request into the first memory space, after the second processor writes the processing result corresponding to one service request into the second memory space, the second processor is usually in an idle state to wait for the first processor to write the preprocessing data corresponding to the next service request into the first memory space. However, after the second processor in this example writes the processing result corresponding to one service request into the second memory space, in the process that the first processor performs post-processing on the corresponding service request, the second processor in this example may perform target processing on the pre-processing data corresponding to another service request, so that the second processor is prevented from being in an idle state in the process that the second processor performs post-processing on the corresponding service request in the first processor, the computing resource of the second processor is fully utilized, and the utilization rate of the computing resource of the second processor is improved.
According to the service request processing method provided by the embodiment of the disclosure, under the condition that the first processor is determined to write the preprocessing data corresponding to the service request into the first memory space, the second processor performs target processing on the preprocessing data, and after the processing result obtained through the target processing is written into the second memory space, the second processor continues to perform target processing on the second preprocessing data under the condition that the second preprocessing data exist in the first memory space. Therefore, when a plurality of service requests are processed, the second processor is prevented from being in an idle state in the process of post-processing the service requests by the first processor, the computing resources of the second processor are fully utilized, and the utilization rate of the computing resources on the second processor is improved.
In one embodiment of the present disclosure, in a case where a process identifier corresponding to the first preprocessing data is further stored in the first memory space, the process identifier is an identifier of a first process corresponding to preprocessing the first service request in the first processor. In order to further fully utilize computing resources on the second processor, the second processor is prevented from being in an idle state, the target processing in this example is performed by at least one second process. In order to clearly understand how to perform target processing on the preprocessed data based on at least one second process, the embodiment further provides a service request processing method. In order that the present disclosure may be clearly understood, an exemplary description of the service request processing method of this embodiment is described below with reference to fig. 6.
Fig. 6 is a schematic diagram according to a sixth embodiment of the present disclosure.
As shown in fig. 6, the service request processing method includes the steps of:
in step 601, for each second process, if it is monitored that the first preprocessed data exists in the first memory space, target processing is performed on the first preprocessed data.
The first preprocessing data are written into the first memory space by the first processor, and the first preprocessing data are obtained by preprocessing a received first service request by the first processor.
Step 602, calling the second process, and performing target processing on the acquired first preprocessing data.
And step 603, writing the process identifier and the processing result obtained by the target processing into the second memory space correspondingly.
The processing result in the second memory space is used for indicating the first processor to perform post-processing on the processing result in the second memory space so as to obtain a corresponding request result.
Step 604, obtaining next unprocessed first preprocessed data from the first memory space until the first preprocessed data in the first memory space is all processed.
Step 605, when it is monitored that second pre-processing data exists in the first memory space, invoking the second process to perform target processing on the second pre-processing data, where the second pre-processing data is obtained by the first processor pre-processing the received second service request, and the second service request is received by the first processor before it monitors that there is a processing result in the second memory space.
In this example, the at least one second process may be configured to process the preprocessed data in the first memory space in parallel, thereby fully utilizing computing resources on the second processor.
Based on the above embodiment, in the case that the above target process is executed by at least one second process, in order to adaptively allocate process resources to the second process on the second processor, for each second process, the execution complexity of executing the target process is determined, and according to the execution complexity, corresponding process resources are allocated to the second process.
In some examples, the execution time consuming for executing the target process may be obtained, and the memory resources occupied by executing the target process may be determined, and the execution complexity for executing the target process may be determined based on the memory resources and the execution time consuming.
In this example, based on the execution complexity of executing the target process, corresponding process resources are adaptively allocated to the second process on the second processor, so that automatic allocation of the process resources is realized, the allocated process resources can meet the requirement of the target process, and accuracy of process resource allocation is improved.
It should be noted that, in this exemplary embodiment, the first processor and the second processor may be located in the same electronic device, or may be located in different electronic devices, which is not limited in particular.
It will be appreciated that the predicted service performance of a trained artificial intelligence model typically needs to be tested before the artificial intelligence model can be applied to the actual business. The related art generally deploys an artificial intelligence model on a second processor, and deploys preprocessing and post-processing corresponding to the artificial intelligence model on a first processor. In order that the disclosed embodiments may be clearly understood, the present example describes exemplary methods of the embodiments in connection with a predictive service for an artificial intelligence model, where it is to be understood that the target process in the present example is a predictive process.
Fig. 7 is a schematic diagram according to a seventh embodiment of the present disclosure.
As shown in fig. 7, the service request processing method includes the steps of:
in step 701, a first memory space and a second memory space are created.
It should be noted that, in this example, the first memory space is used for storing the preprocessing data, and the second memory space is used for storing the processing result.
Step 702, a preset number of second processes are created.
In some examples, the preset number is preset according to actual requirements, and the embodiment is not particularly limited thereto.
The second process in this example may also be referred to as a prediction process, and is mainly used for performing prediction processing based on the prediction operation of the artificial intelligence model.
In some examples, the second process may call a prediction function used by a prediction operation of the artificial intelligence model and perform a prediction process on the corresponding pre-processed data based on the prediction function.
Step 703 of determining a second number of first processes to be created according to the first execution time consuming for performing the preprocessing, the second execution time consuming for performing the prediction processing, and the number of second processes.
The first process in this example may also be referred to as a request processing process, where the first process is mainly used for preprocessing a service request and post-processing a processing result corresponding to the service request.
Step 704, a second number of first processes is created.
It should be noted that, in this example, the first process and the second process may communicate with each other through the first memory space, or may communicate with each other through the second memory space.
Step 705, for each first process, call the first process, perform preprocessing according to a first service request that is not preprocessed in the plurality of first service requests corresponding to the artificial intelligence model, and store the preprocessed data obtained by preprocessing in the first memory space.
Step 706, for each second process, call the second process to obtain unprocessed preprocessed data from the first memory space, perform prediction processing on the processed data according to the prediction operation of the artificial intelligence model, and write the processing result obtained by the prediction into the second memory space.
Step 707, calling the first process to post-process the processing result to obtain a corresponding request result when it is monitored that the processing result of the pre-processed data corresponding to the process identifier of the first process exists in the second memory space.
Step 708, when it is monitored that the processing result of the preprocessing data corresponding to the process identifier of the first process does not exist in the second memory space, and the service request which is not preprocessed exists in the plurality of first service requests, invoking the first process to continue preprocessing the first service request which is not preprocessed next in the plurality of first service requests.
In step 709, when it is monitored that the processing result of the preprocessing data corresponding to the process identifier of the first process does not exist in the second memory space, and preprocessing is completed in the plurality of first service requests, and the second service request is received, the first process may be invoked to preprocess the second service request.
It should be noted that, in the example diagram of the relationship among the first process, the second process, the first memory space and the second memory space, as shown in fig. 8, it should be noted that, in fig. 8, after preprocessing a corresponding service request for each of the N first processes, the preprocessed data may be written into the first memory space. Correspondingly, each second process in the M second processes can acquire unprocessed pretreatment data from the first memory space, can conduct prediction processing on the acquired pretreatment data, and stores a processing result obtained by prediction into the second memory space. Correspondingly, for each first process in the N first processes, the first process can acquire an unprocessed processing result from the second memory space, perform post-processing on the acquired processing result, and perform post-processing on the acquired request result. Note that in fig. 8, N and M are integers greater than 1.
Fig. 9 is a schematic diagram according to an eighth embodiment of the present disclosure. It should be noted that, the service request processing apparatus in this example may be applied to the first processor.
As shown in fig. 9, the service request processing apparatus 90 may include: a first preprocessing module 901, a post-processing module 902, and a second preprocessing module 903, wherein:
the first preprocessing module 901 is configured to preprocess a received first service request, and write preprocessed data obtained by the preprocessing into a first memory space, where the preprocessed data in the first memory space is used to instruct a second processor to perform target processing on the preprocessed data, and write a processing result into the second memory space.
And the post-processing module 902 is configured to perform post-processing on the processing result in the second memory space to obtain a corresponding request result when it is monitored that the processing result of the second processor on the pre-processed data exists in the second memory space.
The second preprocessing module 903 is configured to preprocess the second service request before a processing result of the second processor on the preprocessed data is monitored in the second memory space, and when the second service request is received.
The service request processing device provided by the disclosure performs preprocessing on a received first service request, writes preprocessed data obtained by preprocessing into a first memory space, and if the second service request is received before a processing result of a second processor on the preprocessed data in a second memory space is monitored, continues to perform preprocessing on the second service request, and performs post-processing on the processing result in the second memory space to obtain a corresponding request result when the processing result of the second processor on the preprocessed data is monitored in the second memory space. Therefore, the first processor can preprocess the received second service request before monitoring that the second processor processes the preprocessing data in the second memory space, and the utilization rate of computing resources is improved.
In an embodiment of the present disclosure, fig. 10 is a schematic diagram according to a ninth embodiment of the present disclosure. As shown in fig. 10, the service request processing apparatus 100 may include: a first preprocessing module 1001, a post-processing module 1002, a second preprocessing module 1003, a first determining module 1004, a second determining module 1005, a process creation module 1006, and a resource allocation module 1007, wherein the second determining module 1005 includes: a first determining unit 10051 and a second determining unit 10052.
In one embodiment of the present disclosure, in a case where the first service request is plural, preprocessing of the plural first service requests is performed by plural first processes, and the first preprocessing module 1001 is specifically configured to: for each first process: acquiring a first service request which is not preprocessed from a plurality of first service requests; invoking the first process, preprocessing the acquired first service request, and writing preprocessed data obtained by preprocessing into a first memory space; and acquiring a next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed.
In one embodiment of the present disclosure, the second preprocessing module 1003 is specifically configured to: before a processing result of the second processor on the preprocessed data is monitored in the second memory space, and under the condition that a second service request is received, acquiring a target process in an idle state from a plurality of first processes; and preprocessing the second service request through the target process.
In one embodiment of the present disclosure, in a case that the second processor performs the target processing on the preprocessed data in the first memory space through the at least one second process, the apparatus further includes:
a first determining module 1004, configured to determine a first execution time consuming for performing the preprocessing, and determine a second execution time consuming for performing the target processing;
a second determining module 1005, configured to determine a second number of first processes to be created according to the first execution time, the second execution time, and the first number of at least one second process;
process creation module 1006 for creating a second number of first processes.
In one embodiment of the present disclosure, the apparatus further comprises:
a resource allocation module 1007 for, for each first process: determining the execution complexity of executing preprocessing; and according to the execution complexity, corresponding process resources are allocated for the first process.
In one embodiment of the present disclosure, the second determining module 1005 includes:
a first determining unit 10051, configured to determine a ratio of the first execution time and the second execution time;
a second determining unit 10052, configured to determine a second number of the first processes to be created according to the ratio and the first number of the at least one second process.
In one embodiment of the present disclosure, the second determining unit 10052 is specifically configured to: summing the comparison value and a preset numerical value to obtain a summation value; the sum value and the first number of at least one second process are multiplied to obtain a second number of first processes to be created.
In one embodiment of the present disclosure, the first process is further configured to perform post-processing, and the first preprocessing module 1001 is specifically configured to: writing the process identification of the first process and the preprocessed data obtained by preprocessing into a first memory space correspondingly;
the post-processing module 1002 is specifically configured to: for each first process: and under the condition that the processing result corresponding to the process identifier of the first process exists in the second memory space, calling the first process, and performing post-processing on the processing result to obtain a corresponding request result.
It should be noted that, the foregoing description of the embodiment of the service request processing method is also applicable to the service request processing apparatus, and this embodiment will not be repeated herein.
Fig. 11 is a schematic diagram according to a tenth embodiment of the present disclosure. It should be noted that, the service request processing apparatus in this example may be applied to the second processor.
As shown in fig. 11, the service request processing apparatus 110 may include: a first processing module 1101, a writing module 1102, and a second processing module 1103, wherein:
the first processing module 1101 is configured to perform target processing on first pre-processed data when it is monitored that first pre-processed data exists in the first memory space, where the first pre-processed data is written into the first memory space by the first processor, and the first pre-processed data is obtained by preprocessing a received first service request by the first processor.
The writing module 1102 is configured to write the processing result obtained by the target processing into the second memory space, where the processing result in the second memory space is used to instruct the first processor to post-process the processing result in the second memory space, so as to obtain a corresponding request result.
The second processing module 1103 is configured to perform target processing on second pre-processed data when it is monitored that second pre-processed data exists in the first memory space, where the second pre-processed data is obtained by the first processor pre-processing a received second service request, and the second service request is received by the first processor before it is monitored that there is a processing result in the second memory space.
In the service request processing device provided in the embodiment of the present disclosure, when determining that the first processor writes the pre-processing data corresponding to the service request into the first memory space, the second processor performs target processing on the pre-processing data, writes a processing result obtained by the target processing into the second memory space, and when monitoring that the second pre-processing data exists in the first memory space, the second processor continues to perform target processing on the second pre-processing data. Therefore, when a plurality of service requests are processed, the second processor is prevented from being in an idle state in the process of post-processing the service requests by the first processor, the computing resources of the second processor are fully utilized, and the utilization rate of the computing resources on the second processor is improved.
Fig. 12 is a schematic diagram according to an eleventh embodiment of the present disclosure.
As shown in fig. 12, the service request processing apparatus 120 may include a first processing module 1201, a writing module 1202, a second processing module 1203, and a resource allocation module 1204, where:
in one embodiment of the present disclosure, a process identifier corresponding to the first preprocessing data is further stored in the first memory space, where the process identifier is an identifier of a first process corresponding to preprocessing the first service request in the first processor, and the target processing is executed by at least one second process, and the first processing module 1201 is specifically configured to: for each second process: acquiring unprocessed first preprocessing data from a first memory space; invoking the second process to perform target processing on the acquired first preprocessing data; acquiring next unprocessed first preprocessing data from the first memory space until the first preprocessing data in the first memory space all complete target processing;
The writing module 1202 is specifically configured to: and correspondingly writing the process identifier and the processing result obtained by target processing into the second memory space.
In one embodiment of the present disclosure, the resource allocation module 1204 is configured to, for each second process: determining the execution complexity of the execution target process; and according to the execution complexity, corresponding process resources are allocated for the second process.
It should be noted that, the foregoing description of the embodiment of the service request processing method is also applicable to the service request processing apparatus, and this embodiment will not be repeated herein.
The embodiment of the disclosure also provides a service request processing system.
Fig. 13 is a schematic diagram according to a twelfth embodiment of the present disclosure.
As shown in fig. 13, the service request processing system 130 may include:
a first processor 1301 and a second processor 1302,
the first processor 1301 is configured to execute a service request processing method according to an embodiment of the first aspect of the present disclosure;
the second processor 1302 is configured to perform a service processing method according to an embodiment of the second aspect of the present disclosure.
It should be noted that, for a specific description of the service request processing method, reference may be made to the related description of the embodiments of the present disclosure, which is not repeated here.
The service processing system provided by the embodiment of the disclosure performs preprocessing on the received first service request, writes the preprocessed data obtained by preprocessing into the first memory space, and if the second service request is received before the second processor processes the preprocessed data in the second memory space is monitored, continues to perform preprocessing on the second service request, and performs post-processing on the processed result in the second memory space to obtain a corresponding request result when the second processor processes the preprocessed data in the second memory space. Therefore, the first processor can preprocess the received second service request before monitoring that the second processor processes the preprocessing data in the second memory space, and the utilization rate of computing resources is improved.
In the technical scheme of the disclosure, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of various data accord with the regulations of related laws and regulations, and the public order is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 14 is a block diagram of an electronic device 1400 used to implement a business request processing method of an embodiment of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 14, the apparatus 1400 includes a processor 1401, which can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 1402 or a computer program loaded from a storage unit 1408 into a Random Access Memory (RAM) 1403. In the RAM 1403, various programs and data required for the operation of the device 1400 can also be stored. The processor 1401, ROM 1402, and RAM 1403 are connected to each other through a bus 1404. An input/output (I/O) interface 1405 is also connected to the bus 1404.
Various components in device 1400 are connected to I/O interface 1405, including: an input unit 1406 such as a keyboard, a mouse, or the like; an output unit 1407 such as various types of displays, speakers, and the like; a storage unit 1408 such as a magnetic disk, an optical disk, or the like; and a communication unit 1409 such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 1409 allows the device 1400 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunications networks.
The processor 1401 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of processor 1401 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 1401 performs the respective methods and processes described above, for example, a service request processing method. For example, in some embodiments, the business request processing method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 1408. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 1400 via the ROM 1402 and/or the communication unit 1409. When a computer program is loaded into RAM 1403 and executed by processor 1401, one or more steps of the service request processing method described above may be performed. Alternatively, in other embodiments, the processor 1401 may be configured to perform the service request processing method in any other suitable way (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On 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, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code 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 code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. 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. The 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 pointing device (e.g., a mouse or 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 may 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 input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background 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 background, 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 a client and a server. The client and server are typically 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. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (20)

1. A service request processing method applied to a first processor, the method comprising:
preprocessing a received first service request, writing preprocessed data obtained by preprocessing into a first memory space, wherein the preprocessed data in the first memory space is used for indicating a second processor to perform target processing on the preprocessed data, and writing a processing result into the second memory space;
When the second processor monitors that the processing result of the preprocessing data exists in the second memory space, post-processing is carried out on the processing result in the second memory space so as to obtain a corresponding request result;
preprocessing a second service request before monitoring that the processing result of the second processor on the preprocessed data exists in the second memory space and under the condition that the second service request is received;
and when the number of the first service requests is multiple, preprocessing the multiple first service requests is performed by multiple first processes, preprocessing the received first service requests, and writing preprocessed data obtained by preprocessing into a first memory space, wherein the preprocessing comprises the following steps:
for each first process:
acquiring a first service request which is not preprocessed from a plurality of first service requests;
invoking the first process, preprocessing the acquired first service request, and writing preprocessed data obtained by preprocessing into a first memory space;
acquiring a next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed;
Wherein, in the case that the second processor performs target processing on the preprocessed data in the first memory space through at least one second process, the method further includes:
determining a first execution time consuming for executing the preprocessing and determining a second execution time consuming for executing the target processing;
determining a ratio of the first execution time consumption and the second execution time consumption;
determining a second number of first processes to be created according to the ratio and the first number of the at least one second process;
creating said second number of said first processes.
2. The method of claim 1, wherein preprocessing the second service request before the second processor monitors that there is a processing result of the preprocessed data in the second memory space, and in a case that the second service request is received, includes:
acquiring a target process in an idle state from the plurality of first processes before a processing result of the second processor on the preprocessed data is monitored to exist in the second memory space and under the condition that a second service request is received;
and preprocessing the second service request through the target process.
3. The method of claim 1, wherein after the creating the second number of the first processes, the method further comprises:
for each first process:
determining an execution complexity of executing the preprocessing;
and distributing corresponding process resources for the first process according to the execution complexity.
4. The method of claim 1, wherein the determining the second number of first processes to be created from the ratio and the first number of at least one second process comprises:
summing the ratio and a preset value to obtain a summation value;
multiplying the sum value and the first number of the at least one second process to obtain the second number of the first processes to be created.
5. The method of any of claims 1-4, wherein the first process is further configured to perform the post-processing,
the writing the preprocessed data obtained by preprocessing into the first memory space includes:
writing the process identification of the first process and the preprocessed data obtained by preprocessing into a first memory space correspondingly;
and under the condition that the processing result of the second processor on the preprocessed data exists in the second memory space, performing post-processing on the processing result in the second memory space to obtain a corresponding request result, wherein the post-processing comprises the following steps:
And calling the first process to perform post-processing on the processing result to obtain a corresponding request result under the condition that the processing result of the preprocessing data corresponding to the process identifier of the first process exists in the second memory space.
6. A service request processing method applied to a second processor, the method comprising:
performing target processing on first preprocessing data under the condition that the first preprocessing data exist in a first memory space is monitored, wherein the first preprocessing data are written into the first memory space by a first processor, and the first preprocessing data are obtained by preprocessing a received first service request by the first processor;
writing a processing result obtained through target processing into a second memory space, wherein the processing result in the second memory space is used for indicating the first processor to perform post-processing on the processing result in the second memory space so as to obtain a corresponding request result;
performing target processing on second preprocessing data under the condition that the second preprocessing data exist in the first memory space is monitored, wherein the second preprocessing data are obtained by preprocessing a received second service request by the first processor, and the second service request is received by the first processor before the first processor monitors that the processing result exists in the second memory space;
Wherein, when the first service requests are plural, the preprocessing of the first service requests by the first processor is performed by plural first processes, the first processor preprocesses the received first service requests, and writes the processing data obtained by the preprocessing into the first memory space, including:
for each first process:
acquiring a first service request which is not preprocessed from a plurality of first service requests;
invoking the first process, preprocessing the acquired first service request, and writing the preprocessed processing data into a first memory space;
acquiring a next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed;
wherein, in the case that the second processor performs target processing on the preprocessed data in the first memory space through at least one second process, the method further includes:
determining a first execution time consuming for executing the preprocessing and determining a second execution time consuming for executing the target processing;
determining a ratio of the first execution time consumption and the second execution time consumption;
Determining a second number of first processes to be created according to the ratio and the first number of the at least one second process;
creating said second number of said first processes.
7. The method of claim 6, wherein the first memory space further stores a process identifier corresponding to the first preprocessed data, the process identifier is an identifier of a first process corresponding to preprocessing the first service request in the first processor, the target processing is performed by at least one second process, and the performing target processing on the first preprocessed data includes:
for each second process:
acquiring unprocessed first preprocessing data from the first memory space;
invoking the second process to perform target processing on the acquired first preprocessing data;
acquiring next unprocessed first preprocessing data from the first memory space until the first preprocessing data in the first memory space all complete target processing;
the writing the processing result obtained by the target processing into the second memory space includes:
and correspondingly writing the process identifier and the processing result obtained by target processing into a second memory space.
8. The method of claim 7, wherein the method further comprises:
for each second process:
determining an execution complexity of executing the target process;
and distributing corresponding process resources for the second process according to the execution complexity.
9. A service request processing apparatus for use with a first processor, the apparatus comprising:
the first preprocessing module is used for preprocessing a received first service request, writing preprocessed data obtained by preprocessing into a first memory space, wherein the preprocessed data in the first memory space are used for indicating a second processor to perform target processing on the preprocessed data, and writing a processing result into the second memory space;
the post-processing module is used for carrying out post-processing on the processing result in the second memory space to obtain a corresponding request result when the processing result of the second processor on the preprocessing data is monitored to exist in the second memory space;
the second preprocessing module is used for preprocessing the second service request before the second processor monitors that the processing result of the preprocessed data exists in the second memory space and under the condition that the second service request is received;
Wherein, when the first service requests are plural, preprocessing the plural first service requests is performed by plural first processes, and the first preprocessing module is specifically configured to:
for each first process:
acquiring a first service request which is not preprocessed from a plurality of first service requests;
invoking the first process, preprocessing the acquired first service request, and writing preprocessed data obtained by preprocessing into a first memory space;
acquiring a next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed;
wherein, in the case that the second processor performs target processing on the preprocessed data in the first memory space through at least one second process, the apparatus further includes:
a first determining module configured to determine a first execution time consuming for executing the preprocessing, and determine a second execution time consuming for executing the target processing;
a second determining module, configured to determine a second number of first processes to be created according to the first execution time, the second execution time, and the first number of the at least one second process;
A process creation module for creating the second number of the first processes;
wherein the second determining module includes:
a first determining unit configured to determine a ratio of the first execution time consumption and the second execution time consumption;
and the second determining unit is used for determining a second number of the first processes to be created according to the ratio and the first number of the at least one second process.
10. The apparatus of claim 9, wherein the second preprocessing module is specifically configured to:
acquiring a target process in an idle state from the plurality of first processes before a processing result of the second processor on the preprocessed data is monitored to exist in the second memory space and under the condition that a second service request is received;
and preprocessing the second service request through the target process.
11. The apparatus of claim 9, wherein the apparatus further comprises:
a resource allocation module for, for each first process:
determining an execution complexity of executing the preprocessing;
and distributing corresponding process resources for the first process according to the execution complexity.
12. The apparatus of claim 9, wherein the second determining unit is specifically configured to:
summing the ratio and a preset value to obtain a summation value;
multiplying the sum value and the first number of the at least one second process to obtain the second number of the first processes to be created.
13. The apparatus according to any of claims 9-12, wherein the first process is further configured to perform the post-processing, the first pre-processing module being specifically configured to: writing the process identification of the first process and the preprocessed data obtained by preprocessing into a first memory space correspondingly;
the post-processing module is specifically configured to:
for each first process:
in case that the process identification of the first process corresponds to the processing result in the second memory space is monitored,
and calling the first process, and performing post-processing on the processing result to obtain a corresponding request result.
14. A service request processing apparatus for use with a second processor, the apparatus comprising:
the first processing module is used for performing target processing on first preprocessing data under the condition that the first preprocessing data exist in a first memory space is monitored, wherein the first preprocessing data are written into the first memory space by a first processor, and the first preprocessing data are obtained by preprocessing a received first service request by the first processor;
The writing module is used for writing the processing result obtained through target processing into a second memory space, wherein the processing result in the second memory space is used for indicating the first processor to perform post-processing on the processing result in the second memory space so as to obtain a corresponding request result;
the second processing module is used for performing target processing on second preprocessing data under the condition that the second preprocessing data exist in the first memory space is monitored, wherein the second preprocessing data are obtained by preprocessing a received second service request by the first processor, and the second service request is received by the first processor before the first processor monitors that the processing result exists in the second memory space;
wherein, when the first service requests are plural, preprocessing the plural first service requests is performed by plural first processes, and the first preprocessing module is specifically configured to:
for each first process:
acquiring a first service request which is not preprocessed from a plurality of first service requests;
invoking the first process, preprocessing the acquired first service request, and writing preprocessed data obtained by preprocessing into a first memory space;
Acquiring a next first service request which is not preprocessed from the plurality of first service requests until the plurality of first service requests are preprocessed;
wherein, in the case that the second processor performs target processing on the preprocessed data in the first memory space through at least one second process, the apparatus further includes:
a first determining module configured to determine a first execution time consuming for executing the preprocessing, and determine a second execution time consuming for executing the target processing;
a second determining module, configured to determine a second number of first processes to be created according to the first execution time, the second execution time, and the first number of the at least one second process;
a process creation module for creating the second number of the first processes;
wherein the second determining module includes:
a first determining unit configured to determine a ratio of the first execution time consumption and the second execution time consumption;
and the second determining unit is used for determining a second number of the first processes to be created according to the ratio and the first number of the at least one second process.
15. The apparatus of claim 14, wherein a process identifier corresponding to the first preprocessing data is further stored in the first memory space, the process identifier is an identifier of a first process corresponding to preprocessing the first service request in the first processor, the target processing is performed by at least one second process, and the first processing module is specifically configured to:
For each second process:
acquiring unprocessed first preprocessing data from the first memory space;
invoking the second process to perform target processing on the acquired first preprocessing data;
acquiring next unprocessed first preprocessing data from the first memory space until the first preprocessing data in the first memory space all complete target processing;
the writing module is specifically configured to: and correspondingly writing the process identifier and the processing result obtained by target processing into a second memory space.
16. The apparatus of claim 15, wherein the apparatus further comprises:
a resource allocation module for, for each second process:
determining an execution complexity of executing the target process;
and distributing corresponding process resources for the second process according to the execution complexity.
17. A service request processing system, the system comprising:
a first processor and a second processor,
wherein the first processor is configured to perform the method of any one of claims 1-5;
the second processor is configured to perform the method of any of claims 6-8.
18. An electronic device, comprising:
At least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
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-5 or the method of any one of claims 6-8.
19. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-5 or the method of any one of claims 6-8.
20. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any one of claims 1-5, or the steps of the method of any one of claims 6-8.
CN202211182518.2A 2022-09-27 2022-09-27 Service request processing method and device Active CN115495312B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211182518.2A CN115495312B (en) 2022-09-27 2022-09-27 Service request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211182518.2A CN115495312B (en) 2022-09-27 2022-09-27 Service request processing method and device

Publications (2)

Publication Number Publication Date
CN115495312A CN115495312A (en) 2022-12-20
CN115495312B true CN115495312B (en) 2023-07-18

Family

ID=84471653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211182518.2A Active CN115495312B (en) 2022-09-27 2022-09-27 Service request processing method and device

Country Status (1)

Country Link
CN (1) CN115495312B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096352A (en) * 2019-04-28 2019-08-06 腾讯科技(上海)有限公司 Process management method, device and computer readable storage medium
US10967274B1 (en) * 2019-03-13 2021-04-06 Amazon Technologies, Inc. Dynamic management of processes executing on computing instances
WO2022062537A1 (en) * 2020-09-27 2022-03-31 苏州浪潮智能科技有限公司 Data compression method and apparatus, and computer-readable storage medium
CN114969857A (en) * 2021-02-25 2022-08-30 湖南大学 Structural design optimization method, system, computer equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109933429A (en) * 2019-03-05 2019-06-25 北京达佳互联信息技术有限公司 Data processing method, device, electronic equipment and storage medium
CN114035947A (en) * 2021-11-01 2022-02-11 杭州萤石软件有限公司 Method, device, equipment and system for dynamically allocating resources
CN114119374A (en) * 2021-11-29 2022-03-01 北京百度网讯科技有限公司 Image processing method, device, equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10967274B1 (en) * 2019-03-13 2021-04-06 Amazon Technologies, Inc. Dynamic management of processes executing on computing instances
CN110096352A (en) * 2019-04-28 2019-08-06 腾讯科技(上海)有限公司 Process management method, device and computer readable storage medium
WO2022062537A1 (en) * 2020-09-27 2022-03-31 苏州浪潮智能科技有限公司 Data compression method and apparatus, and computer-readable storage medium
CN114969857A (en) * 2021-02-25 2022-08-30 湖南大学 Structural design optimization method, system, computer equipment and storage medium

Also Published As

Publication number Publication date
CN115495312A (en) 2022-12-20

Similar Documents

Publication Publication Date Title
CN113961351B (en) Distributed training method, device, equipment and storage medium for deep learning model
CN113849312B (en) Data processing task allocation method and device, electronic equipment and storage medium
CN114819084B (en) Model reasoning method, device, equipment and storage medium
US20220343512A1 (en) Method and apparatus of processing image, electronic device, and storage medium
CN113904943B (en) Account detection method and device, electronic equipment and storage medium
CN115495312B (en) Service request processing method and device
CN116126719A (en) Interface testing method and device, electronic equipment and storage medium
CN116302218A (en) Function information adding method, device, equipment and storage medium
CN113657408B (en) Method and device for determining image characteristics, electronic equipment and storage medium
CN113627526B (en) Vehicle identification recognition method and device, electronic equipment and medium
CN113377295B (en) Data storage and reading method, device and equipment for multi-producer single-consumer
CN113360672B (en) Method, apparatus, device, medium and product for generating knowledge graph
CN115690443A (en) Feature extraction model training method, image classification method and related device
CN114386577A (en) Method, apparatus, and storage medium for executing deep learning model
CN113535187B (en) Service online method, service updating method and service providing method
CN113360407B (en) Function positioning method and device, electronic equipment and readable storage medium
CN114428646B (en) Data processing method and device, electronic equipment and storage medium
CN114816758B (en) Resource allocation method and device
CN115292662B (en) Convolution acceleration operation method and device, electronic equipment and storage medium
CN115860077B (en) Method, device, equipment and storage medium for processing state data
CN113011494B (en) Feature processing method, device, equipment and storage medium
CN115600687B (en) Model training method, device, equipment and storage medium
CN113900734B (en) Application program file configuration method, device, equipment and storage medium
CN117093266A (en) Instruction processing device, method, electronic device, and storage medium
CN116384466A (en) Multi-operator parallel processing method, device, equipment and medium for deep learning model

Legal Events

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