Task execution method and device, equipment and storage medium

By creating multiple target program instances on the server and assigning unused instances to execute tasks when receiving task requests, the problem of slow response speed in high concurrency scenarios is solved, and concurrency processing capability and response speed are improved.

CN119720961APending Publication Date: 2025-03-28SHENZHEN HONGHE INNOVATION INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411689937.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In high concurrency scenarios, the prior art responds slowly when responding to screenshot requests and cannot effectively handle a large number of concurrent task requests.

Method used

The server pre-creates multiple instances of the target program, and upon receiving a task request, it determines the target instance that is not used from these instances, and runs the instance to execute the preset tasks corresponding to the task request.

Benefits of technology

By creating multiple instances in advance, the server can quickly allocate target instances when receiving task requests, improving concurrent processing capabilities and response speed, and ensuring the normal execution of a large number of concurrent task requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119720961A_ABST
    Figure CN119720961A_ABST
Patent Text Reader

Abstract

The invention discloses a task execution method and device, equipment and a storage medium, and belongs to the technical field of computers. The method comprises the steps that a server side creates a plurality of instances of a target program, wherein the target program is used for executing a preset task; one or more task requests are received. Wherein each time the server receives one task request, a target instance is determined from the multiple instances, the target instance is an unused instance, and the target instance is operated to execute the preset task corresponding to the task request. According to the method and the device, the concurrent processing capability of the server can be improved, normal execution of the preset tasks corresponding to the task requests can be ensured under the condition that a large number of concurrent task requests exist, and the response speed of the task requests is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a task execution method, apparatus, system, device, program product and storage medium. Background Art

[0002] With the continuous development of science and technology, the technology of converting the hypertext markup language (HTML) content in web pages into images for display has gradually become popular. For example, the screenshot function in the courseware editor can convert HTML content into images for display.

[0003] In the related art, after the user triggers the screenshot function in the courseware editor, the courseware editor sends a screenshot request to the server. After receiving the screenshot request, the server creates a browser instance and starts it to perform the corresponding screenshot operation. However, this method has a slow response speed in high-concurrency scenarios. Summary of the invention

[0004] The present application provides a task execution method, apparatus, device and storage medium, which can improve the response speed of each task request. The technical solution is as follows:

[0005] In a first aspect, a task execution method is provided, the method comprising:

[0006] The server creates multiple instances of a target program, and the target program is used to execute a preset task;

[0007] The server receives one or more task requests;

[0008] Wherein, the server performs the following operations each time it receives a task request:

[0009] Determine a target instance from the multiple instances, the target instance being an instance that is not in use;

[0010] The target instance is run to execute the preset task corresponding to the task request.

[0011] In the present application, the server creates multiple instances of the target program in advance. Afterwards, one or more task requests are received. Wherein, each time a task request is received, the target instance is determined from the multiple instances, and the target instance is run to execute the preset task corresponding to the task request. In this way, when the server receives one or more task requests, the server can directly allocate a target instance from the multiple instances to each task request to execute the corresponding preset task. In this way, the concurrent processing capability of the server can be improved, and in the case of a large number of concurrent task requests, the normal execution of the preset tasks corresponding to each task request can also be guaranteed, thereby improving the response speed of each task request.

[0012] Optionally, each of the multiple instances has a usage status, the usage status includes activated and inactivated, and determining the target instance from the multiple instances includes:

[0013] Iterate over the multiple instances;

[0014] If the usage status of one of the traversed instances is inactive, the instance is determined as the target instance.

[0015] Optionally, each of the multiple instances has a usage state and a creation time, and determining the target instance from the multiple instances includes:

[0016] Iterate over the multiple instances;

[0017] If the usage status of one of the traversed instances is inactive, then when it is determined according to the creation time of the instance that the creation duration of the instance is less than or equal to the first preset duration, the instance is determined as the target instance.

[0018] Optionally, after determining the instance as the target instance, the method further includes:

[0019] Setting the usage state of the target instance to activated;

[0020] After running the target instance, the method further includes:

[0021] After the target instance is finished running, the usage state of the target instance is set to inactive.

[0022] Optionally, the method further comprises:

[0023] For any of the traversed instances, if it is determined based on the creation time of the instance that the creation duration of the instance is greater than the first preset duration and less than or equal to the second preset duration, and the usage status of the instance is inactivated, the instance is deleted; or, if it is determined based on the creation time of the instance that the creation duration of the instance is greater than the second preset duration, the instance is deleted.

[0024] Optionally, determining a target instance from the multiple instances includes:

[0025] If the multiple instances are not locked, locking the multiple instances;

[0026] determining the target instance from the multiple instances;

[0027] After the target instance is determined from the multiple instances, the multiple instances are unlocked.

[0028] Optionally, the method further comprises:

[0029] If the target instance is not determined from the multiple instances, a new instance of the target program is created as the target instance.

[0030] Optionally, the creating multiple instances of the target program includes:

[0031] Multiple instances of the target program are created at startup.

[0032] Optionally, the preset task is a screenshot task, a presentation PPT to Hypertext Markup Language HTML task, a video transcoding task, or a file format conversion task.

[0033] In a second aspect, a task execution method is provided, the method comprising:

[0034] The server creates multiple instances of a target program, where the target program is used to execute a preset task;

[0035] Each of the one or more clients sends a task request to the server;

[0036] Each time the server receives a task request, it determines a target instance from the multiple instances, where the target instance is an unused instance; and runs the target instance to execute the preset task corresponding to the task request.

[0037] A third aspect provides a task execution method, the method comprising:

[0038] The server creates multiple instances of a target program, where the target program is used to execute a preset task;

[0039] Each of the one or more clients sends a task request to the cloud storage server;

[0040] Each time the cloud storage server receives a file acquisition request, it searches for response data of the file acquisition request in the cloud storage server; if the response data of the file acquisition request is found, it sends the response data of the file acquisition request to the client corresponding to the file acquisition request; if the response data of the file acquisition request is not found, it sends a task request corresponding to the file acquisition request to the server;

[0041] After receiving the task request, the service determines a target instance from the multiple instances, where the target instance is an unused instance; runs the target instance to execute the preset task corresponding to the task request, and obtains response data of the task request; and sends the response data of the task request to the cloud storage server;

[0042] After receiving the response data of the task request, the cloud storage server determines the response data of the task request as the response data of the file acquisition request, stores the response data of the file acquisition request, and sends the response data of the file acquisition request to the client corresponding to the file acquisition request.

[0043] In the embodiment of the present application, the cloud storage server can store the response data of the file acquisition request, so when the client sends the same file acquisition request, the cloud storage server can directly return the response data to the client, which can improve resource utilization and reduce the concurrent request volume of the server. Moreover, in the present application, even if the server receives a large number of concurrent task requests, it can ensure that the preset tasks corresponding to each task request are executed normally, thereby improving the response speed of each task request.

[0044] In a fourth aspect, a task execution device is provided, the device comprising:

[0045] A first creation module, used to create multiple instances of a target program, wherein the target program is used to execute a preset task;

[0046] A receiving module, used for receiving one or more task requests;

[0047] The execution module is used to determine a target instance from the multiple instances each time the receiving module receives a task request, wherein the target instance is an unused instance, and run the target instance to execute the preset task corresponding to the task request.

[0048] In a fifth aspect, a communication system is provided, the communication system comprising one or more clients and a server;

[0049] The server is used to create multiple instances of a target program, and the target program is used to execute a preset task;

[0050] The client is used to send a task request to the server;

[0051] The server is used to determine a target instance from the multiple instances each time a task request is received, where the target instance is an unused instance; and run the target instance to execute the preset task corresponding to the task request.

[0052] In a sixth aspect, a communication system is provided, the communication system comprising one or more clients, a cloud storage server and a server;

[0053] The server is used to create multiple instances of a target program, and the target program is used to execute a preset task;

[0054] The client is used to send a task request to the cloud storage server;

[0055] The cloud storage server is configured to search for response data of the file acquisition request in the cloud storage server each time a file acquisition request is received; if the response data of the file acquisition request is found, the response data of the file acquisition request is sent to the client corresponding to the task request; if the response data of the file acquisition request is not found, the task request corresponding to the file acquisition request is sent to the server;

[0056] The server is used to determine a target instance from the multiple instances after receiving the task request, wherein the target instance is an unused instance; run the target instance to execute the preset task corresponding to the task request, and obtain response data of the task request; and send the response data of the task request to the cloud storage server;

[0057] The cloud storage server is used to, after receiving the response data of the task request, determine the response data of the task request as the response data of the file acquisition request, store the response data of the file acquisition request, and send the response data of the file acquisition request to the client corresponding to the file acquisition request.

[0058] In a seventh aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the task execution method described in the first aspect.

[0059] In an eighth aspect, a computer program product is provided. When the computer program product is run on a computer device, the computer device executes the task execution method described in the first aspect.

[0060] In a ninth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the task execution method described in the first aspect is implemented.

[0061] It can be understood that the beneficial effects of the second, fourth, fifth, seventh, eighth and ninth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and the beneficial effects of the sixth aspect mentioned above can be found in the relevant description of the third aspect mentioned above, and they will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0063] Figure 1 is a schematic diagram of a communication system provided in an embodiment of the present application;

[0064] Figure 2 is a schematic diagram of another communication system provided in an embodiment of the present application;

[0065] Figure 3 is a flowchart of a task execution method provided in an embodiment of the present application;

[0066] Figure 4 is a flowchart of another task execution method provided by an embodiment of the present application;

[0067] Figure 5 is a flowchart of another task execution method provided by an embodiment of the present application;

[0068] Figure 6 is a flowchart of another task execution method provided by an embodiment of the present application;

[0069] Figure 7 is a schematic diagram of a task execution device provided in an embodiment of the present application;

[0070] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0072] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

[0073] The phrases such as "one embodiment" or "some embodiments" described in the present application mean that the specific features, structures or characteristics described in the embodiment are included in one or more embodiments of the present application. Therefore, the phrases such as "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments" that appear in the differences in the present application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. In addition, the terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0074] The application scenarios of the embodiments of the present application are described below.

[0075] The task execution method provided in the embodiment of the present application can be applied to file processing scenarios to help people process files. The file processing scenarios may include one or more scenarios such as screenshot scenarios (such as HTML content to image), presentation (power point, PPT) to HTML scenarios, video transcoding scenarios, file format conversion scenarios, etc.

[0076] The following is an exemplary description of the communication system involved in the task execution method provided in the embodiment of the present application.

[0077] Figure 1 is a schematic diagram of a communication system provided in an embodiment of the present application. Figure 1 , the communication system 10 may include a client 101 and a server 102 .

[0078] The client 101 can communicate with the server 102 via a wired connection or a wireless connection.

[0079] The client 101 may be installed in a terminal. For example, the terminal may be a mobile phone, a tablet computer, a laptop computer, a desktop computer, a smart blackboard, an interactive conference screen, etc., which is not limited in the present application embodiment.

[0080] The server 102 may be installed in a server. For example, the server may be a single server or a server cluster including multiple servers, which is not limited in the present embodiment.

[0081] The number of the client 101 may be one or more. Different clients 101 may be installed in different terminals.

[0082] The client 101 is used to send a task request to the server 102. For example, the client 101 may be an application (APP). For example, the client 101 may be a courseware editor, a presentation editor, a video transcoder, or a file format converter.

[0083] For example, if the client 101 is a courseware editor, the task request sent by the client 101 may be a screenshot request, which is used to request to convert HTML content into an image.

[0084] For another example, if the client 101 is a presentation editor, the task request sent by the client 101 may be a PPT to HTML request, which is used to request to convert a PPT document into an HTML web page.

[0085] For another example, if the client 101 is a video transcoder, the task request sent by the client 101 may be a video transcoding request, which is used to request to convert a video from one video format to another video format.

[0086] For another example, if the client 101 is a file format converter, then the task request sent by the client 101 may be a file format conversion request, where the file format conversion is used to request to convert a file from one file format to another file format.

[0087] The server 102 is used to create multiple instances of the target program, and after receiving the task request sent by the client 101, determine the target instance from the multiple instances, and run the target instance to execute the preset task corresponding to the task request.

[0088] The target program is a program for processing task requests, that is, a program for executing preset tasks.

[0089] For example, the target program may be a screenshot program, a PPT to HTML program, a video transcoding program, or a file format conversion program, etc. In some embodiments, the screenshot program, the PPT to HTML program, the video transcoding program, and the file format conversion program may all be browser driver (webdriver) programs.

[0090] The preset task can be pre-set. For example, the preset task can be a screenshot task, a PPT to HTML task, a video transcoding task, or a file format conversion task, etc., which is not limited in the embodiment of the present application.

[0091] For example, if the target program is a screenshot program, after the server 102 receives the screenshot request, the screenshot task can be executed through the target program.

[0092] For another example, if the target program is a PPT-to-HTML program, after the server 102 receives the PPT-to-HTML request, the PPT-to-HTML task can be executed through the target program.

[0093] For another example, if the target program is a video transcoding program, after the server 102 receives the video transcoding request, the video transcoding task can be executed through the target program.

[0094] For another example, if the target program is a file format conversion program, after the server 102 receives the file format conversion request, the file format conversion task can be executed through the target program.

[0095] The target instance is an unused instance among the multiple instances of the target program.

[0096] For example, the multiple instances may be webdriver instances. The multiple instances may be created in advance. For example, the multiple instances may be created when the server 102 is started.

[0097] After receiving the task request, the server 102 may run the target instance to automatically execute the preset task corresponding to the task request, and obtain the response data of the task request. The server 102 may send the response data of the task request to the client 101.

[0098] For example, when the target instance is a webdriver instance, the target instance can call selenium (browser automation testing framework) to execute a preset task.

[0099] In the embodiment of the present application, the server 102 can create multiple instances of the target program in advance. Afterwards, when the server 102 receives a task request sent by one or more clients 101, it can allocate a target instance from the multiple instances to each task request to execute the corresponding preset task. In this way, the concurrent processing capability of the server 102 can be improved. In the case of a large number of concurrent task requests, the normal execution of the preset tasks corresponding to each task request can also be guaranteed, and the response speed of each task request can be improved.

[0100] Figure 2 is a schematic diagram of another communication system provided in an embodiment of the present application. Figure 2 The communication system 20 may include a client 201 , a cloud storage server 202 , and a service end 203 .

[0101] The client 201 may communicate with the cloud storage server 202 via a wired connection or a wireless connection.

[0102] The cloud storage server 202 can communicate with the service end 203 via a wired connection or a wireless connection.

[0103] The client 201 may be installed in a terminal. For example, the terminal may be a mobile phone, a tablet computer, a laptop computer, a desktop computer, etc., which is not limited in the present embodiment of the application.

[0104] The server 202 may be installed in a server. For example, the server may be a single server or a server cluster including multiple servers, which is not limited in the present embodiment.

[0105] The number of the client 201 may be one or more. Different clients 201 may be installed in different terminals.

[0106] The client 201 is used to send a file acquisition request to the cloud storage server 202. For example, the client 201 can be an APP. For example, the client 101 can be a courseware editor, a presentation editor, a video transcoder, or a file format converter.

[0107] The file acquisition request is used to request to obtain the target file corresponding to the original file.

[0108] For example, the file acquisition request can be used to request to obtain an image corresponding to the original HTML content. Alternatively, the file acquisition request can be used to request to obtain an HTML webpage corresponding to the original PPT document. Alternatively, the file acquisition request can be used to request to obtain a video of a specified format corresponding to the original video. Alternatively, the file acquisition request can be used to request to obtain a file of a specified format corresponding to the original file.

[0109] The cloud storage server 202 is used to receive a file acquisition request sent by the client 201, search for response data of the file acquisition request in the cloud storage server 202, and return the response data to the client 201 if the response data of the file acquisition request is found; if the response data of the file acquisition request is not found, it sends a task request corresponding to the file acquisition request to the server 203, then receives and stores the response data returned by the server 203, and returns the response data to the client 201.

[0110] The task request corresponding to the file acquisition request is used to request the execution of a preset task to obtain the target file requested by the file acquisition request.

[0111] For example, if the file acquisition request is used to request to obtain an image corresponding to the original HTML content, then the task request corresponding to the file acquisition request is a screenshot request, and the screenshot request is used to request to convert the original HTML content into an image.

[0112] Alternatively, if the file acquisition request is used to request to obtain the HTML web page corresponding to the original PPT document, then the task request corresponding to the file acquisition request is a PPT to HTML request, and the PPT to HTML request is used to request to convert the original PPT document into an HTML web page.

[0113] Alternatively, if the file acquisition request is used to request to obtain a video of a specified format corresponding to the original video, then the task request corresponding to the file acquisition request is a video transcoding request, which is used to request to convert the original video into a video of a specified format.

[0114] Alternatively, if the file acquisition request is used to request to obtain a file of a specified format corresponding to the original file, then the task request corresponding to the file acquisition request is a file format conversion request, which is used to request to convert the original file into a file of a specified format.

[0115] For example, the cloud storage server 202 may store and manage data through an object storage service (OSS).

[0116] For example, the cloud storage server 202 may send a task request to the server 203 through the image back-to-source function of the OSS.

[0117] The server 203 is used to create multiple instances of the target program, and when receiving a task request sent by the cloud storage server 202, it determines the target instance from the multiple instances, runs the target instance to execute the preset task corresponding to the task request, obtains response data of the task request, and sends the response data of the task request to the cloud storage server 202.

[0118] The target program, the multiple instances, and the target instance are described above. Figure 1 The embodiments are used to illustrate and will not be described in detail here.

[0119] In an embodiment of the present application, one or more clients 201 may send a file acquisition request to a cloud storage server 202. After receiving the file acquisition request, the cloud storage server 202 may first search for the response data of the file acquisition request in itself; if the response data of the file acquisition request is found, the response data is directly returned to the client 201 corresponding to the file acquisition request, so that the response speed of the file acquisition request can be improved; if the response data of the file acquisition request is not found, a task request corresponding to the file acquisition request is sent to the server 203, and after receiving the response data returned by the server 203, the response data may be stored and returned to the client 201 corresponding to the file acquisition request. In this case, when the client 201 repeatedly sends the same file acquisition request to the cloud storage server 202, the cloud storage server 202 may send the stored response data of the file acquisition request to the client 201, without the need for the server 203 to repeatedly perform the preset task. In this way, resource utilization can be improved, the processing pressure of the server 203 can be reduced, and the processing performance of the server 203 can be guaranteed.

[0120] The task execution method provided in the embodiment of the present application is explained in detail below.

[0121] Figure 3 is a flowchart of a task execution method provided in an embodiment of the present application. The task execution method can be applied to Figure 1 or Figure 2 The communication system shown can be specifically applied to Figure 1 Server 102 in, or applied to Figure 2 The server 203 in. See Figure 3 , the method comprises the following steps:

[0122] Step 301: The server creates multiple instances of a target program, where the target program is used to execute a preset task.

[0123] For example, the target program may be a screenshot program, a PPT to HTML program, a video transcoding program, or a file format conversion program.

[0124] The preset task executed by the screenshot program may be a screenshot task, the preset task executed by the PPT to HTML program may be a PPT to HTML task, the preset task executed by the video transcoding program may be a video transcoding task, and the preset task executed by the file format conversion program may be a file format conversion task.

[0125] Each of the multiple instances of the target program is used to execute a preset task.

[0126] For example, the multiple instances of the target program may be created by the server when it is started. For example, the multiple instances may be stored in an instance library.

[0127] For example, the server may create 10 instances of the target program at startup.

[0128] For example, the code for the server to create 10 instances of the target program may be as follows:

[0129] for i in range(10):

[0130] Server.browsers.append(Browser())

[0131] In some embodiments, each time the server creates a new instance of the target program, it may set the usage status of the instance to inactive and record the creation time of the instance.

[0132] The usage status of an instance is used to indicate whether the instance is currently running. That is, when the usage status of the instance is inactive, it means that the instance is not running; when the usage status of the instance is active, it means that the instance is running.

[0133] The creation time of an instance is the time when the instance is created.

[0134] Step 302: The server receives one or more task requests.

[0135] Optionally, the task request may carry a device address, a target file type and an original file address, wherein the device address is the network address of the device to be accessed, the target file type is the file type of the target file requested by the task request, and the original file address is the storage address of the original file.

[0136] For example, the device address in the task request may be a server address.

[0137] For example, the original file address may be a message-digest algorithm (MD5) 5 address. For example, the original file address may be an MD5 value obtained by performing MD5 calculation on the original file.

[0138] In some embodiments, the one or more task requests received by the server may be sent by the client. For example, the one or more task requests may be Figure 1 Sent by client 101 in .

[0139] For example, the client may be a courseware editor, a presentation editor, a video transcoder, or a file format converter, etc.

[0140] For example, if the client is a courseware editor, the format of the screenshot request received by the server may be https: / / server address / IMAGE(image) / MD5.

[0141] For another example, if the client is a presentation editor, the format of the PPT to HTML request received by the server may be https: / / server address / PPT2HTML / MD5.

[0142] For another example, if the client is a video transcoder, the format of the video transcoding request received by the server may be https: / / server address / moving picture experts group 4 (MP4) / MD5.

[0143] For another example, if the client is a file format converter, the format of the file format conversion request received by the server may be https: / / server address / DOC / MD5.

[0144] In some other embodiments, the one or more task requests received by the server may be sent by the cloud storage server. For example, the one or more task requests may be Figure 2 For example, each of the one or more task requests may be sent by the cloud storage server 202 to the server 203 after the client 201 sends a file acquisition request to the cloud storage server 202, and the cloud storage server 202 does not find the response data of the file acquisition request.

[0145] Optionally, the file acquisition request may carry a device address, a target file type, and an original file address.

[0146] For example, the device address in the file acquisition request may be a cloud storage server address.

[0147] The target file type and the original file address in the file acquisition request are the same as the target file type and the original file address in the task request corresponding to the file acquisition request.

[0148] For example, if the client is a courseware editor, the file acquisition request sent by the client to the cloud storage server may be an image file acquisition request, and the format of the image file acquisition request may be https: / / cloud storage server address / IMAGE / MD5. The task request corresponding to the image file acquisition request may be a screenshot request, and the format of the screenshot request may be https: / / server address / IMAGE / MD5.

[0149] For another example, if the client is a presentation editor, the file acquisition request sent by the client to the cloud storage server may be an HTML file acquisition request, and the format of the HTML file acquisition request may be https: / / cloud storage server address / PPT2HTML / MD5. The task request corresponding to the image file acquisition request may be a PPT to HTML request, and the format of the PPT to HTML request may be https: / / server address / PPT2HTML / MD5.

[0150] For another example, if the client is a video transcoder, the file acquisition request sent by the client to the cloud storage server may be a video file acquisition request, and the format of the video file acquisition request may be https: / / cloud storage server address / MP4 / MD5. The task request corresponding to the video file acquisition request may be a video transcoding request, and the format of the video transcoding request may be https: / / server address / MP4 / MD5.

[0151] For another example, if the client is a file format converter, the file acquisition request sent by the client to the cloud storage server may be a specified format file acquisition request, and the format of the specified format file acquisition request may be https: / / cloud storage server address / FILE / MD5. The task request corresponding to the specified format file acquisition request may be a file format conversion request, and the format of the file format conversion request may be https: / / server address / DOC / MD5.

[0152] Wherein, the server may execute the following steps 3021 to 3022 each time it receives a task request:

[0153] Step 3021: The server determines a target instance from the multiple instances each time it receives a task request.

[0154] The target instance is an unused instance among the multiple instances.

[0155] The server determines a target instance from the multiple instances, that is, determines an instance that can currently process the task request.

[0156] In some embodiments, the operation of the server determining the target instance from the multiple instances may include the following two methods:

[0157] The first method: each of the multiple instances has a usage status, which may include activated and inactivated. In this case, the server traverses the multiple instances; if the usage status of an instance traversed is inactivated, the server determines the instance as the target instance.

[0158] If the usage status of an instance is activated, it means that the instance is running, that is, the instance is executing the preset task corresponding to other task requests, so the instance is not determined as the target instance, and the traversal continues to the next instance; if the usage status of an instance is not activated, it means that the instance is not running, that is, the instance is not currently executing the preset task corresponding to other task requests, so the instance can be determined as the target instance so that the preset task corresponding to the task request can be executed through the instance later.

[0159] For example, the code for the server to determine the target instance from the multiple instances is as follows:

[0160] if not b.get_active():

[0161] browser=b

[0162] browser.set_active(True)

[0163] break.

[0164] The second method: each of the multiple instances has a usage status and a creation time. In this case, the server traverses the multiple instances; if the usage status of an instance traversed is inactive, the server determines that the creation duration of the instance is less than or equal to the first preset duration based on the creation time of the instance, and determines the instance as the target instance.

[0165] The creation duration of an instance is the time between the creation time of the instance and the current time. For example, the server can start timing the creation duration of the instance after the creation of the instance is completed.

[0166] The first preset duration is used to indicate whether the instance needs to be deleted. The instance will occupy memory during operation, and will continuously cause cache and data accumulation, which will affect system performance, and the instance may have problems such as memory leaks when running for a long time, which will affect system security. For this reason, in the embodiment of the present application, it can be determined whether the creation duration of the instance is greater than the first preset duration to determine whether the instance needs to be deleted. In this way, when an instance has been created for a long time, the instance can be released in time, thereby ensuring system performance and system security.

[0167] The first preset duration can be preset. For example, the first preset duration can be set to 590 seconds, 600 seconds, 610 seconds, etc., which is not limited in the embodiment of the present application.

[0168] If the usage status of a traversed instance is inactivated, and the creation duration of the instance is less than or equal to the first preset duration, it means that the instance is currently in an idle state and does not meet the deletion condition, so the instance can be determined as the target instance; if the usage status of a traversed instance is activated, it means that the instance is running, so the instance is not determined as the target instance, and the traversal continues to the next instance; if the usage status of a traversed instance is inactivated, but the creation duration of the instance is greater than the first preset duration, it means that the instance meets the deletion condition, so the instance is not determined as the target instance, and the traversal continues to the next instance.

[0169] For example, the code for the server to determine whether the creation time of an instance is greater than the first preset time is as follows:

[0170] if runningTime>600:

[0171] continue.

[0172] In some cases, for any instance traversed, if the server determines that the creation duration of the instance is greater than the first preset duration and less than or equal to the second preset duration based on the creation time of the instance, and the usage status of the instance is inactive, the instance is deleted. Alternatively, if the server determines that the creation duration of the instance is greater than the second preset duration based on the creation time of the instance, the instance is deleted.

[0173] The second preset duration is used to indicate whether to delete the instance immediately. The second preset duration can be preset. For example, the second preset duration can be set to 649 seconds, 650 seconds, 651 seconds, etc., which is not limited in the embodiment of the present application.

[0174] An instance may start executing a preset task when its creation duration is close to the first preset duration, which may result in the creation duration of the instance being greater than the first preset duration and less than or equal to the second preset duration when the instance is traversed, and the usage status of the instance is activated. If the instance is deleted at this time, the preset task executed by the instance cannot be completed normally, so the instance can be paused without being deleted so that the instance can complete the preset task being executed normally.

[0175] If the creation duration of an instance is greater than the first preset duration and less than or equal to the second preset duration, and the usage status of the instance is inactive, it means that the creation duration of the instance meets the deletion condition and the instance is currently in idle state, so the instance can be deleted.

[0176] If the creation time of an instance is longer than the second preset time, it means that the instance has been created for too long and the preset task has not been completed after a period of time (i.e. the difference between the second preset time and the first preset time). Therefore, it can be determined that the instance is likely to be abnormal, so the instance can be deleted immediately.

[0177] For example, the code for the server to determine whether the creation time of an instance is greater than the second preset time is as follows:

[0178] if runningTime>650:

[0179] del Server.browsers[i]

[0180] destoryBrowsers.append(b)

[0181] continue.

[0182] In some embodiments, if the server fails to determine the target instance from the multiple instances, the server may create a new instance of the target program as the target instance. Optionally, the server may add the newly created instance to the instance library.

[0183] For example, the server may set the usage status of the newly created instance to inactivated, and record the creation time of the instance.

[0184] In some embodiments, before the server determines the target instance from the multiple instances, it may first determine whether the multiple instances are locked. If the multiple instances are not locked, the server may first lock the multiple instances, then determine the target instance from the multiple instances, and then unlock the multiple instances after determining the target instance from the multiple instances. If the server is locked, it needs to wait for the multiple instances to be unlocked, then lock the multiple instances, then determine the target instance from the multiple instances, and then unlock the multiple instances after determining the target instance from the multiple instances.

[0185] Since the server may receive multiple task requests in a short period of time in a high concurrency scenario, if the target instance for processing the task request is determined from the multiple instances immediately after each task request is received, a concurrency conflict may occur, that is, it may be determined that the target instances of multiple task requests are the same instance. For this reason, in an embodiment of the present application, when the server receives a task request, it first determines whether the multiple instances are locked. If locked, it first waits for the multiple instances to be unlocked. If not locked, it first locks the multiple instances and then determines the target instance for processing the task request. After determining the target instance, the multiple instances are unlocked. In this way, concurrency conflicts can be avoided.

[0186] For example, the server code for locking the multiple instances is as follows:

[0187] Lock = threading.RLock().

[0188] For example, the code for unlocking the multiple instances on the server is as follows:

[0189] lock.release().

[0190] In some embodiments, after the server determines the target instance, it may update the usage status of the target instance to activated.

[0191] Step 3022: The server runs the target instance to execute the preset task corresponding to the task request.

[0192] In some embodiments, the operation of the target instance executing the preset task corresponding to the task request may be: the target instance obtains the original file according to the original file address in the task request, and then processes the original file according to the target file type in the task request to obtain the target file, which is the response data of the task request. Optionally, after obtaining the target file, the target instance may end its operation.

[0193] For example, if the task request is a screenshot request, the target instance can obtain HTML content according to the original file address in the screenshot request, and then convert the HTML content into an image according to the target file type (i.e., image) in the screenshot request, and the image is the target file.

[0194] For example, if the task request is a PPT to HTML request, the target instance can obtain the PPT document according to the original file address in the PPT to HTML request, and then convert the PPT document into an HTML web page according to the target file type (i.e. HTML) in the PPT to HTML request, and the HTML web page is the target file.

[0195] For example, if the task request is a video transcoding request, the target instance can obtain the video according to the original file address in the video transcoding request, and then convert the video into a video of a specified format (such as MP4) according to the target file type (such as MP4) in the video transcoding request. The video in the specified format is the target file.

[0196] For example, if the task request is a file format conversion request, the target instance can obtain the file according to the original file address in the file format conversion request, and then convert the file into a file of a specified format (such as DOC) according to the target file type (such as DOC) in the file format conversion request. The file of the specified format is the target file.

[0197] In some embodiments, after the target instance ends its operation, the server may set the usage status of the target instance to inactivated.

[0198] In some cases, the server may send response data of the task request to the sender of the task request (such as a client or a cloud storage server).

[0199] For ease of understanding, the following Figure 4 The above task execution method is illustrated by way of example.

[0200] Figure 4 is a flowchart of a task execution method provided by an embodiment of the present application. Figure 4 , the method includes steps 401 to 410.

[0201] Step 401: The server creates multiple instances of the target program when starting up.

[0202] Step 402: The server receives one or more task requests.

[0203] Step 403: The server traverses the multiple instances starting from the first instance each time it receives a task request.

[0204] Step 404: The server determines whether the currently traversed instance is inactive.

[0205] If the instance is not activated, execute step 405; if the instance is activated, execute step 406.

[0206] Step 405: The server determines whether the creation duration of the instance is less than or equal to a first preset duration.

[0207] If the creation duration of the instance is less than or equal to the first preset duration, step 409 is executed; if the creation duration of the instance is greater than the first preset duration, step 406 is executed.

[0208] Step 406: The server determines whether the instance is the last instance among the multiple instances.

[0209] If the instance is not the last instance among the multiple instances, step 407 is executed; if the instance is the last instance among the examples, step 408 is executed.

[0210] Step 407: The server continues to traverse the next instance and executes step 404.

[0211] Step 408: The server creates a new instance of the target program.

[0212] Step 409: The server runs the instance to execute the preset task corresponding to the task request.

[0213] In an embodiment of the present application, the server creates multiple instances of the target program in advance. Afterwards, the server receives one or more task requests. Wherein, each time the server receives a task request, it determines the target instance from the multiple instances, runs the target instance, and executes the preset task corresponding to the task request. In this way, when the server receives one or more task requests, it can directly allocate a target instance from the multiple instances to each task request to execute the corresponding preset task. In this way, the concurrent processing capability of the server can be improved, and in the case of a large number of concurrent task requests, the normal execution of the preset tasks corresponding to each task request can also be guaranteed, thereby improving the response speed of each task request.

[0214] Figure 5 is a flowchart of a task execution method provided in an embodiment of the present application. The task execution method can be applied to Figure 1 The communication system shown. Figure 5 , the method comprises the following steps:

[0215] Step 501: The server creates multiple instances of the target program.

[0216] The operation of step 501 is similar to the operation of step 301 described above, and will not be described in detail in the embodiment of the present application.

[0217] Step 502: Each of the one or more clients sends a task request to the server.

[0218] The client can be Figure 1 The client 101 in FIG. 101 may be, for example, a courseware editor, a presentation editor, a video transcoder, or a file format converter.

[0219] For example, if the client is a courseware editor, the user can trigger the screenshot function after editing a courseware in the courseware editor, so that the courseware editor sends a screenshot request to the server to request that the HTML content in the courseware be converted into an image (such as a thumbnail).

[0220] For another example, if the client is a presentation editor, the user can click a presentation conversion button in the interface of the presentation editor to cause the presentation editor to send a PPT to HTML request to the server to convert the PPT document selected by the user in the presentation editor into an HTML web page.

[0221] For another example, if the client is a video transcoder, the user can click a video transcoding button in the interface of the video transcoder to cause the video transcoder to send a video transcoding request to the server to request conversion of the video selected by the user in the video transcoder into other formats.

[0222] For another example, if the client is a file format converter, the user can click a format conversion button in the interface of the file format converter, causing the file format converter to send a file format conversion request to the server to request that the file selected by the user in the file format converter be converted to another format.

[0223] Step 503: Each time the server receives a task request, it determines a target instance from the multiple instances and runs the target instance to execute the preset task corresponding to the task request.

[0224] The operation of step 503 is similar to the operations of the above-mentioned steps 3021 and 3022, and will not be described in detail in the embodiment of the present application.

[0225] After obtaining the response data of the task request, the server may send the response data of the task request to the client corresponding to the task request.

[0226] Figure 6 is a flowchart of a task execution method provided in an embodiment of the present application. The task execution method can be applied to Figure 2The communication system shown. Figure 6 , the method comprises the following steps:

[0227] Step 601: The server creates multiple instances of the target program.

[0228] The operation of step 601 is similar to the operation of step 301 described above, and will not be described in detail in the embodiment of the present application.

[0229] Step 602: Each of the one or more clients sends a file acquisition request to the cloud storage server.

[0230] The client can be Figure 2 The client 201 in FIG. 4 may be a courseware editor, a presentation editor, a video transcoder, or a file format converter, etc.

[0231] For example, if the client is a courseware editor, the user can trigger the screenshot function after editing a courseware in the courseware editor, so that the courseware editor sends an image file acquisition request to the cloud storage server to request the image (such as a thumbnail) corresponding to the HTML content in the courseware.

[0232] For another example, if the client is a presentation editor, the user can click the presentation conversion button in the interface of the presentation editor to cause the presentation editor to send an HTML file acquisition request to the cloud storage server to request the HTML web page corresponding to the PPT document selected by the user in the presentation editor.

[0233] For another example, if the client is a video transcoder, the user can click a video transcoding button in the interface of the video transcoder to cause the video transcoder to send a video file acquisition request to the cloud storage server to request videos in other formats corresponding to the video selected by the user in the video transcoder.

[0234] For another example, if the client is a file format converter, the user can click a format conversion button in the interface of the file format converter, causing the file format converter to send a request to obtain a file in a specified format to the cloud storage server, requesting to obtain files in other formats corresponding to the file selected by the user in the file format converter.

[0235] Step 603: The cloud storage server receives one or more file acquisition requests.

[0236] Step 604: Whenever the cloud storage server receives a file acquisition request, the cloud storage server searches for response data of the file acquisition request in the cloud storage server.

[0237] If the response data of the file acquisition request is found, step 605 is executed. If the response data of the file acquisition request is not found, step 606 is executed.

[0238] In some embodiments, the operation of the cloud storage server searching for the response data of the file acquisition request in the cloud storage server can be: determining whether the cloud storage server has a target file stored corresponding to the target file type and original file address in the file acquisition request; if so, determining the target file as the response data of the file acquisition request; if not, determining that the response data of the file acquisition request has not been found.

[0239] Step 605: The cloud storage server sends response data of the file acquisition request to the client corresponding to the file acquisition request.

[0240] Step 606: The cloud storage server sends a task request corresponding to the file acquisition request to the server.

[0241] Step 607: After receiving the task request, the server determines a target instance from the multiple instances, runs the target instance to execute the preset task corresponding to the task request, obtains response data of the task request, and sends the response data of the task request to the cloud storage server.

[0242] The operation of step 607 is similar to the operations of the above-mentioned steps 3021 and 3022, and will not be described in detail in the embodiment of the present application.

[0243] Step 608: After receiving the response data of the task request, the cloud storage server determines the response data of the task request as the response data of the file acquisition request, stores the response data of the file acquisition request, and sends the response data of the file acquisition request to the client corresponding to the file acquisition request.

[0244] For example, when the cloud storage server stores the response data of the file acquisition request, the response data of the file acquisition request (ie, the target file) may be stored in correspondence with the target file type and the original file address in the file acquisition request.

[0245] After the cloud storage server stores the response data of the file acquisition request, if the cloud storage server receives the same file acquisition request subsequently, the cloud storage server can directly return the stored response data to the client, thereby improving the response speed of the file acquisition request.

[0246] In an embodiment of the present application, the server creates multiple instances of the target program. Afterwards, each of the one or more clients sends a file acquisition request to the cloud storage server. Each time the cloud storage server receives a file acquisition request, it searches for the response data of the file acquisition request in the cloud storage server; if the response data of the file acquisition request is found, the response data of the file acquisition request is sent to the client corresponding to the file acquisition request; if the response data of the file acquisition request is not found, the task request corresponding to the file acquisition request is sent to the server. Each time the server receives a task request, it determines the target instance from the multiple instances and runs it to execute the preset task corresponding to the task request, obtains the response data of the task request and sends it to the cloud storage server. After receiving the response data of the task request, the cloud storage server determines the response data of the task request as the response data of the file acquisition request and stores it, and sends the response data of the file acquisition request to the client corresponding to the file acquisition request. Since the cloud storage server can store the response data of the file acquisition request, when the client sends the same file acquisition request, the cloud storage server can directly return the response data to the client, which can improve resource utilization and reduce the concurrent request volume of the server. Moreover, in the embodiment of the present application, even if the server receives a large number of concurrent task requests, it can ensure that the preset tasks corresponding to each task request are executed normally, thereby improving the response speed of each task request.

[0247] Figure 7 is a schematic diagram of a task execution device provided in an embodiment of the present application. The device can be implemented as part or all of a computer device by software, hardware, or a combination of both. The computer device can be as follows Figure 8 Computer equipment shown. Figure 7 The device includes: a first creation module 701, a receiving module 702, and an execution module 703.

[0248] A first creation module 701 is used to create multiple instances of a target program, where the target program is used to execute a preset task;

[0249] The receiving module 702 is used to receive one or more task requests;

[0250] The execution module 703 is used to determine a target instance from the multiple instances each time the receiving module 702 receives a task request, where the target instance is an unused instance, and run the target instance to execute a preset task corresponding to the task request.

[0251] Optionally, each of the multiple instances has a usage status, which includes activated and inactivated. The execution module 703 is used to: traverse the multiple instances; if the usage status of a traversed instance is inactivated, determine the instance as the target instance.

[0252] Optionally, each of the multiple instances has a usage status and a creation time, and the execution module 703 is used to: traverse the multiple instances; if the usage status of a traversed instance is inactivated, then when it is determined based on the creation time of the instance that the creation duration of the instance is less than or equal to a first preset duration, the instance is determined as the target instance.

[0253] Optionally, the device further comprises:

[0254] The first setting module is used to set the use state of the target instance to activated.

[0255] Optionally, the device further comprises:

[0256] The second setting module is used to set the use state of the target instance to be inactivated after the target instance ends its operation.

[0257] Optionally, the device further comprises:

[0258] A deletion module is used to delete any traversed instance if, based on the creation time of the instance, the creation duration of the instance is determined to be greater than a first preset duration and less than or equal to a second preset duration, and the usage status of the instance is inactivated; or, if, based on the creation time of the instance, the creation duration of the instance is determined to be greater than the second preset duration, the instance is deleted.

[0259] Optionally, the execution module 703 is used to:

[0260] A locking module, used for locking the multiple instances when the multiple instances are not locked;

[0261] A determination module, used for determining a target instance from the multiple instances;

[0262] The unlocking module is used to unlock the multiple instances after determining the target instance from the multiple instances.

[0263] Optionally, the device further comprises:

[0264] The second creation module is used to create a new instance of the target program as the target instance if the target instance is not determined from the multiple instances.

[0265] Optionally, the first creation module 701 is used to create multiple instances of the target program at startup.

[0266] Optionally, the preset task is a screenshot task, a PPT to HTML task, a video transcoding task, or a file format conversion task.

[0267] In an embodiment of the present application, the device pre-creates multiple instances of the target program. Afterwards, one or more task requests are received. Wherein, each time a task request is received, a target instance is determined from the multiple instances, and the target instance is run to execute the preset task corresponding to the task request. In this way, when the device receives one or more task requests, the target instance can be directly assigned to each task request from the multiple instances to execute the corresponding preset task. In this way, the concurrent processing capability of the device can be improved, and in the case of a large number of concurrent task requests, the normal execution of the preset tasks corresponding to each task request can also be guaranteed, thereby improving the response speed of each task request.

[0268] It should be noted that: the task execution device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when executing tasks. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0269] The functional modules in the above embodiments may be integrated into one processing unit, or each functional module may exist physically as a processing unit alone, or two or more functional modules may be integrated into one processing unit, and the above processing unit may be implemented in the form of hardware or software. In addition, the specific names of the functional modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.

[0270] The task execution device and the task execution method embodiments provided in the above embodiments belong to the same concept. The specific working process of the functional modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.

[0271] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8 As shown, the computer device 8 includes: a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80. When the processor 80 executes the computer program 82, the steps executed by the server in the task execution method in the above embodiment are implemented.

[0272] The computer device 8 may be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device 8 may be a server. Those skilled in the art will appreciate that Figure 8It is only an example of the computer device 8 and does not constitute a limitation on the computer device 8. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.

[0273] The processor 80 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0274] In some embodiments, the memory 81 may be an internal storage unit of the computer device 8, such as a hard disk or memory of the computer device 8. In other embodiments, the memory 81 may also be an external storage device of the computer device 8, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the computer device 8. The memory 81 is used to store an operating system, an application program, a boot loader, data, and other programs. The memory 81 may also be used to temporarily store data that has been output or is to be output.

[0275] An embodiment of the present application also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, and when the processor executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.

[0276] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0277] An embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the steps in the above-mentioned method embodiments.

[0278] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, it can be a non-transient storage medium.

[0279] It should be understood that all or part of the steps to implement the above embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-mentioned computer readable storage medium.

[0280] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0281] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0282] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0283] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0284] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0285] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A task execution method, characterized in that: The method comprises: The server creates multiple instances of a target program, where the target program is used to execute a preset task; The server receives one or more task requests; Wherein, the server performs the following operations each time it receives a task request: Determine a target instance from the multiple instances, the target instance being an instance that is not in use; The target instance is run to execute the preset task corresponding to the task request.

2. The method according to claim 1, characterized in that Each of the multiple instances has a usage status, wherein the usage status includes activation and inactivation, and determining a target instance from the multiple instances includes: Iterate over the multiple instances; If the usage status of one of the traversed instances is inactive, the instance is determined as the target instance.

3. The method according to claim 1, characterized in that Each of the multiple instances has a usage state and a creation time, and determining a target instance from the multiple instances includes: Iterate over the multiple instances; If the usage status of one of the traversed instances is inactive, then when it is determined according to the creation time of the instance that the creation duration of the instance is less than or equal to the first preset duration, the instance is determined as the target instance.

4. The method according to claim 2 or 3, after determining the instance as the target instance, further comprising: Setting the usage state of the target instance to activated; After running the target instance, the method further includes: After the target instance is finished running, the usage state of the target instance is set to inactive.

5. The method according to claim 3, characterized in that The method further comprises: For any of the traversed instances, if it is determined based on the creation time of the instance that the creation duration of the instance is greater than the first preset duration and less than or equal to the second preset duration, and the usage status of the instance is inactivated, the instance is deleted; or, if it is determined based on the creation time of the instance that the creation duration of the instance is greater than the second preset duration, the instance is deleted.

6. The method according to claim 1, characterized in that The determining a target instance from the multiple instances comprises: If the multiple instances are not locked, locking the multiple instances; determining the target instance from the multiple instances; After the target instance is determined from the multiple instances, the multiple instances are unlocked.

7. The method according to claim 1, characterized in that The method further comprises: If the target instance is not determined from the multiple instances, a new instance of the target program is created as the target instance.

8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Each of the one or more clients sends a file acquisition request to the cloud storage server; Each time the cloud storage server receives a file acquisition request, it searches for response data of the file acquisition request in the cloud storage server; if the response data of the file acquisition request is found, the response data of the file acquisition request is sent to the client corresponding to the file acquisition request; if the response data of the file acquisition request is not found, the task request corresponding to the file acquisition request is sent to the server, and after receiving the response data of the task request sent by the server, the response data of the task request is determined as the response data of the file acquisition request, the response data of the file acquisition request is stored, and the response data of the file acquisition request is sent to the client corresponding to the file acquisition request.

9. A task execution device, characterized in that: The device comprises: A first creation module, used to create multiple instances of a target program, wherein the target program is used to execute a preset task; A receiving module, used for receiving one or more task requests; The execution module is used to determine a target instance from the multiple instances each time the receiving module receives a task request, wherein the target instance is an unused instance, and run the target instance to execute the preset task corresponding to the task request.

10. A computer device, characterized in that: The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 8 when executed by the processor.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.