File generation method and device, electronic equipment, storage medium and program product
By acquiring historical parameters from the resource call system and usage parameters from storage units, the task execution logic and resource allocation are dynamically adjusted, solving the problem of unreasonable resource allocation in file generation tasks and achieving more efficient resource utilization and stable output.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-10
AI Technical Summary
The existing resource allocation system cannot dynamically adjust resource allocation according to the actual workload when processing file generation tasks, resulting in idle resources under low load and resource contention under high load, which reduces system efficiency and response speed.
By obtaining historical resource call parameters from the resource call system and space usage parameters from the storage unit, the task execution logic of the file generation task is determined. Based on these parameters, the task execution logic and resource allocation are dynamically adjusted to ensure that the storage unit can stably store and output the target file.
It improves the resource allocation capability of the resource allocation system for file generation tasks, avoids resource waste and system instability, and enhances the overall efficiency and response speed of the system.
Smart Images

Figure CN121833266A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data processing, and in particular, to a file generation method and device, electronic equipment, storage medium and program product. BACKGROUND
[0002] At present, many resource calling systems adopt a fixed resource allocation strategy, such as setting a constant number of central processor cores and a fixed memory space, to process file generation tasks. However, this static resource allocation method cannot be dynamically adjusted according to the actual workload, resulting in a large amount of idle system resources at low load, and resource contention at high load, which reduces the overall efficiency and response speed of the system, and results in poor ability to call system resources.
[0003] At present, no effective solution has been proposed to solve the above problems. SUMMARY
[0004] The embodiments of the present application provide a file generation method, device, electronic equipment, storage medium and program product, to at least solve the technical problem of poor ability to call system resources in the process of executing different file generation tasks to generate target files in related technologies.
[0005] According to an aspect of an embodiment of the present application, a file generation method is provided, comprising: in the case of receiving at least one file generation task, obtaining a historical resource calling parameter of a resource calling system and a space usage parameter of a storage unit, wherein the storage unit is used to store a target file corresponding to the at least one file generation task, and the historical resource calling parameter is used to reflect the resource calling situation of the resource calling system in a first historical time period; determining the task execution logic of any one file generation task based on the historical resource calling parameter; evaluating the file generation task based on the space usage parameter and the task execution logic to obtain a task evaluation result, wherein the task evaluation result is used to represent whether the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic; in the case that the task evaluation result represents that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic, executing the file generation task based on the task execution logic to obtain the target file.
[0006] Further, the file generation task is evaluated based on the space usage parameter and the task execution logic to obtain a task evaluation result, including: based on the task execution logic, estimating a file storage space corresponding to the file generation task, wherein the file storage space is used to represent a storage space required by a target file corresponding to the file generation task when the file generation task is executed according to the task execution logic; based on the space usage parameter, determining a space usage threshold corresponding to the storage unit, wherein the space usage threshold is used to represent a maximum storage space that the storage unit can provide for the target file under a preset storage condition; in the case that the file storage space is less than the space usage threshold, determining that the task evaluation result represents that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic.
[0007] Further, the preset storage condition includes: a read-write speed condition and a data throughput condition; based on the space usage parameter, determining the space usage threshold corresponding to the storage unit, including: obtaining a target read-write speed corresponding to the read-write speed condition, and a target throughput corresponding to the data throughput condition; based on the space usage parameter and the space configuration parameter of the storage unit, determining an initial usage threshold corresponding to the storage unit; inputting the target read-write speed, the target throughput and the initial usage threshold into a threshold adjustment model, and adjusting the initial usage threshold by using the threshold adjustment model to obtain the space usage threshold.
[0008] Further, the task execution logic includes: parallel execution logic and serial execution logic, the parallel execution logic is used to represent multi-threaded execution between different file generation tasks, and the serial execution logic is used to represent single-threaded execution between different file generation tasks; based on the historical resource calling parameter, determining the task execution logic of any one file generation task, including: inputting the historical resource calling parameter into a system evaluation model, and evaluating the load condition of the resource calling system by using the system evaluation model to obtain a state evaluation index; in the case that the state evaluation index is greater than a first preset threshold, determining that the task execution logic is the serial execution logic; in the case that the state evaluation index is less than or equal to the first preset threshold, determining that the task execution logic is the parallel execution logic.
[0009] Further, the historical resource invocation parameter comprises: a first total resource invocation amount corresponding to the resource invocation system at different moments in the first historical time period; the method further comprises: obtaining an initial index threshold; determining an average execution duration of the file generation task in the first time range based on the historical resource invocation parameter, wherein the first time range represents a time range obtained by expanding the target moment, and the target moment represents a moment when the first total resource invocation amount reaches the first resource invocation amount threshold in the first historical time period; obtaining a quotient of the average execution duration and the calibration duration to obtain a duration quotient value, wherein the calibration duration represents an average execution duration of the file generation task of the resource invocation system in the second time range, and any moment included in the second time range is before any moment included in the first time range; constructing the first preset threshold based on the duration quotient value and the initial index threshold.
[0010] Further, the first preset threshold is constructed based on the duration quotient value and the initial index threshold, comprising: in a case where the duration quotient value is greater than a preset quotient value, the initial index threshold is decreased to obtain the first preset threshold; in a case where the duration quotient value is less than or equal to the preset quotient value, the initial index threshold is increased to obtain the first preset threshold.
[0011] Further, the file generation task is executed based on the task execution logic to obtain the target file, comprising: in a case where the task execution logic is a serial execution logic, obtaining a thread state of the resource invocation system, and executing the file generation task based on the thread state to obtain the target file, wherein the thread state represents whether there is a target thread in the resource invocation system that can execute the file generation task; in a case where the task execution logic is a parallel execution logic, obtaining a thread pool state of the resource invocation system, and executing the file generation task based on the thread pool state to obtain the target file, wherein the thread pool state represents whether a new target thread can be added to the resource invocation system to execute the file generation task.
[0012] Further, the file generation task is executed based on the thread state to obtain the target file, comprising: in a case where the thread state represents that there is a target thread in the resource invocation system that can execute the file generation task, the file generation task is added to the target thread based on the priority of the file generation task, and the file generation task is executed by the target thread; in a case where the thread state represents that there is no target thread in the resource invocation system that can execute the file generation task, a new target thread is created, the file generation task is added to the target thread based on the priority of the file generation task, and the file generation task is executed by the target thread.
[0013] Further, the file generation task is executed based on the thread pool state to obtain a target file, including: in a case that the thread pool state indicates that the resource calling system is able to add a new target thread, creating the new target thread and adding the file generation task to the target thread, and executing the file generation task by using the target thread; in a case that the thread pool state indicates that the resource calling system is unable to add the new target thread, adding the file generation task to a task waiting queue, and continuously monitoring the thread pool state until the thread pool state indicates that the resource calling system is able to add the new target thread, creating the new target thread, adding the file generation task to the target thread, and executing the file generation task by using the target thread.
[0014] Further, the thread pool state of the resource calling system is obtained, including: obtaining a thread quantity of threads in a running state in the resource calling system; in a case that the thread quantity is greater than a preset quantity threshold, determining that the thread pool state indicates that the resource calling system is unable to add a new target thread; in a case that the thread quantity is less than the preset quantity threshold, determining that the thread pool state indicates that the resource calling system is able to add the new target thread.
[0015] Further, the method further includes: obtaining a second total resource calling quantity corresponding to different time instants in a second historical time period of the resource calling system, wherein a start instant of the second historical time period is before a start instant of the first historical time period; determining at least one third time range from the second historical time period based on the second total resource calling quantity, wherein the second total resource calling quantity corresponding to any one time instant in the third time range is greater than the second resource calling quantity threshold; obtaining a system performance indicator of the resource calling system in any one third time range, wherein the system performance indicator is used to reflect a running condition of the resource calling system in the third time range; and adjusting the initial quantity threshold based on the system performance indicator to obtain the preset quantity threshold.
[0016] Further, the initial quantity threshold is adjusted based on the system performance indicator to obtain the preset quantity threshold, including: in a case that the system performance indicator is greater than a second preset threshold, decreasing the initial quantity threshold to obtain the preset quantity threshold; and in a case that the system performance indicator is less than or equal to the second preset threshold, increasing the initial quantity threshold to obtain the preset quantity threshold.
[0017] Further, the method further includes: in a case that a file download instruction input by a user is received, parsing the file download instruction to obtain at least one file generation task and a file download task; and in a case that a target file corresponding to the file generation task is stored in a storage unit, outputting the target file by using the storage unit based on the file download task.
[0018] According to another aspect of the present invention, a file generation apparatus is also provided, comprising: a parameter acquisition module, configured to acquire historical resource call parameters of a resource call system and space usage parameters of a storage unit when receiving at least one file generation task, wherein the storage unit is configured to store a target file generated based on the file generation task, and the historical resource call parameters are configured to reflect the resource call status of the resource call system in a first historical time period; a logic determination module, configured to determine the task execution logic of any file generation task based on the historical resource call parameters; a task evaluation module, configured to evaluate the file generation task based on the space usage parameters and the task execution logic to obtain a task evaluation result, wherein the task evaluation result is configured to characterize whether the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic; and a task execution module, configured to execute the file generation task based on the task execution logic to obtain the target file when the task evaluation result characterizes that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic.
[0019] Furthermore, the task evaluation module is also used to: estimate the file storage space corresponding to the file generation task based on the task execution logic, wherein the file storage space is used to characterize the storage space required by the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic; determine the space usage threshold corresponding to the storage unit based on the space usage parameter, wherein the space usage threshold is used to characterize the maximum storage space that the storage unit can provide for the target file under preset storage conditions; and determine the task evaluation result when the file storage space is less than the space usage threshold, indicating that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic.
[0020] Furthermore, the preset storage conditions include: read / write speed conditions and data throughput conditions; the task evaluation module is also used to: obtain the target read / write speed corresponding to the read / write speed conditions, and the target throughput corresponding to the data throughput conditions; determine the initial usage threshold corresponding to the storage unit based on the space usage parameters and the space configuration parameters of the storage unit; input the target read / write speed, target throughput and initial usage threshold into the threshold adjustment model, and use the threshold adjustment model to adjust the initial usage threshold to obtain the space usage threshold.
[0021] Furthermore, the task execution logic includes: parallel execution logic and serial execution logic. The parallel execution logic is used to characterize multi-threaded execution among different file generation tasks, and the serial execution logic is used to characterize single-threaded execution among different file generation tasks. The logic determination module is also used to: input historical resource call parameters into the system evaluation model, use the system evaluation model to evaluate the load of the resource call system, and obtain a status evaluation index; if the status evaluation index is greater than a first preset threshold, determine that the task execution logic is serial execution logic; if the status evaluation index is less than or equal to the first preset threshold, determine that the task execution logic is parallel execution logic.
[0022] Furthermore, the historical resource call parameters include: the first total resource call volume corresponding to different moments in the first historical time period; the above device also includes: a threshold acquisition module for acquiring an initial indicator threshold; a duration determination module for determining the average execution duration of file generation tasks within a first time range based on the historical resource call parameters, wherein the first time range is used to characterize the time range obtained by expanding the target moment, and the target moment is used to characterize the moment when the first total resource call volume reaches the first resource call volume threshold within the first historical time period; a quotient acquisition module for acquiring the quotient between the average execution duration and the calibration duration to obtain a duration quotient value, wherein the calibration duration is used to characterize the average execution duration of file generation tasks in the second time range, and any moment included in the second time range is before any moment included in the first time range; and a threshold construction module for constructing a first preset threshold based on the duration quotient value and the initial indicator threshold.
[0023] Furthermore, the threshold construction module is also used to: reduce the initial indicator threshold to obtain a first preset threshold when the duration quotient is greater than the preset quotient; and increase the initial indicator threshold to obtain a first preset threshold when the duration quotient is less than or equal to the preset quotient.
[0024] Furthermore, the task execution module is also used to: when the task execution logic is serial execution logic, obtain the thread state of the resource call system, and execute the file generation task based on the thread state to obtain the target file, wherein the thread state is used to indicate whether there is a target thread in the resource call system that can execute the file generation task; when the task execution logic is parallel execution logic, obtain the thread pool state of the resource call system, and execute the file generation task based on the thread pool state to obtain the target file, wherein the thread pool state is used to indicate whether the resource call system can add a new target thread to utilize the target thread to execute the file generation task.
[0025] Furthermore, the task execution module is also used to: when there is a target thread in the thread state representation resource call system that can execute the file generation task, add the file generation task to the target thread based on the priority of the file generation task, and use the target thread to execute the file generation task; when there is no target thread in the thread state representation resource call system that can execute the file generation task, create a new target thread, add the file generation task to the target thread based on the priority of the file generation task, and use the target thread to execute the file generation task.
[0026] Furthermore, the task execution module is also used to: when the thread pool state indicates that the resource call system can add a new target thread, create a new target thread, add the file generation task to the target thread, and use the target thread to execute the file generation task; when the thread pool state indicates that the resource call system cannot add a new target thread, add the file generation task to the task waiting queue, and continuously monitor the thread pool state until the thread pool state indicates that the resource call system can add a new target thread, create a new target thread, add the file generation task to the target thread, and use the target thread to execute the file generation task.
[0027] Furthermore, the task execution module is also used to: obtain the number of threads in the resource call system that are running; if the number of threads is greater than a preset threshold, determine that the thread pool status indicates that the resource call system cannot add new target threads; if the number of threads is less than the preset threshold, determine that the thread pool status indicates that the resource call system can add new target threads.
[0028] Furthermore, the aforementioned apparatus further includes: a call volume acquisition module, used to acquire the second total resource call volume of the resource call system at different times in the second historical time period, wherein the start time of the second historical time period is before the start time of the first historical time period; a range determination module, used to determine at least one third time range from the second historical time period based on the second total resource call volume, wherein the second total resource call volume corresponding to any time in the third time range is greater than the second resource call volume threshold; an indicator acquisition module, used to acquire the system performance indicator of the resource call system in any third time range, wherein the system performance indicator is used to reflect the operation of the resource call system in the third time range; and a threshold adjustment module, used to adjust the initial quantity threshold based on the system performance indicator to obtain a preset quantity threshold.
[0029] Furthermore, the threshold adjustment module is also used to: decrease the initial quantity threshold when the system performance index is greater than the second preset threshold to obtain the preset quantity threshold; and increase the initial quantity threshold when the system performance index is less than or equal to the second preset threshold to obtain the preset quantity threshold.
[0030] Furthermore, the above-mentioned device also includes: an instruction parsing module, used to parse the file download instruction input by the user to obtain at least one file generation task and a file download task; and a file output module, used to output the target file based on the file download task by storing the target file corresponding to the file generation task in the storage unit.
[0031] According to another aspect of the present invention, an electronic device is also provided, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the methods of various embodiments of the present invention during runtime.
[0032] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is executed, it controls the device where the computer-readable storage medium is located to perform the methods of various embodiments of the present invention.
[0033] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements the methods of various embodiments of the present invention.
[0034] According to another aspect of the present invention, a computer program product is also provided, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods of various embodiments of the present invention.
[0035] According to another aspect of the present invention, a computer program is also provided, which, when executed by a processor, implements the methods of the various embodiments of the present invention.
[0036] In this embodiment of the invention, when at least one file generation task is received, the following methods are employed: historical resource call parameters of the resource call system and space usage parameters of the storage unit are obtained; based on the historical resource call parameters, the task execution logic for any file generation task is determined; the file generation task is evaluated based on the space usage parameters and the task execution logic to obtain a task evaluation result; if the task evaluation result indicates that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic, the file generation task is executed based on the task execution logic to obtain the target file. By combining the historical resource call parameters of the resource call system to determine the task execution logic of the file generation task, and combining the space usage parameters of the storage unit with the task execution logic, it is determined that the storage unit can stably store and output the target file corresponding to the file generation task. This effectively ensures the rationality of resource allocation by the resource call system for file generation tasks, avoiding resource waste due to insufficient storage space or excessive load on the resource call system. This improves the resource call system's ability to allocate resources for file generation tasks, thereby solving the technical problem of poor system resource access during the execution of different file generation tasks to generate target files in related technologies. Attached Figure Description
[0037] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0038] Figure 1 This is a flowchart illustrating a file generation method according to an embodiment of the present invention;
[0039] Figure 2 This is a schematic diagram illustrating a file generation process according to an embodiment of the present invention;
[0040] Figure 3 This is a structural block diagram of a document generation apparatus according to an embodiment of the present invention. Detailed Implementation
[0041] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0042] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0043] According to an embodiment of the present invention, a document generation method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0044] Figure 1 This is a flowchart illustrating a file generation method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0045] Step S102: Upon receiving at least one file generation task, obtain the historical resource call parameters of the resource call system and the space usage parameters of the storage unit.
[0046] The storage unit is used to store the target file generated based on at least one file generation task, and the historical resource call parameters are used to reflect the resource call status of the resource call system in the first historical time period.
[0047] The aforementioned file generation task refers to a generation task built when downloading data within the resource retrieval system. This task outputs the data as a file for user viewing. The aforementioned resource retrieval system is responsible for processing and responding to various user data requests. The aforementioned historical resource retrieval parameters refer to parameters generated during data processing by the resource retrieval system over a past period, such as average CPU (Central Processing Unit) utilization, memory usage, disk I / O (Input / Output) activity frequency, and network bandwidth utilization. The aforementioned space usage parameters refer to a series of parameters including the total capacity of storage units, used space, available space, and the read / write speed of storage units.
[0048] In one optional embodiment, considering that if a user wants to browse data corresponding to a specific module in the resource retrieval system, such as resource consumption or evaluation reports for a project, the resource retrieval system typically needs to generate corresponding files for each of these data and output these files to the user interface so that the user can view the data they need. This process requires consideration of how to efficiently generate these corresponding files while avoiding excessive consumption of system resources during file generation.
[0049] Therefore, in order to effectively reduce the resources consumed during file generation, the resource allocation system can rationally allocate corresponding task resources to different file generation tasks based on the current resource usage, thereby improving the system's response speed and efficiency in processing tasks and avoiding system performance degradation or task delays caused by resource contention. Based on this, to improve the rationality of allocating corresponding task resources to different file generation tasks, when receiving at least one file generation task, the resource allocation system can first obtain its own historical resource allocation parameters, i.e., the resource allocation situation of the resource allocation system in the first historical time period, such as the total transaction volume, average CPU and memory usage rate within one hour prior to the current moment.
[0050] Meanwhile, considering that after generating the corresponding target file based on the file generation task, the target file is usually not deleted directly, but can be stored in the aforementioned storage unit for easy access and viewing by users, the resource call system can determine the storage unit's space usage parameters while obtaining historical resource call parameters. This is to avoid service interruptions and data loss caused by storage unit overload or disk space exhaustion.
[0051] Step S104: Based on historical resource call parameters, determine the task execution logic for any file generation task.
[0052] The above-mentioned task execution logic can refer to the logical relationship between different file generation tasks during the task execution process, which may include, but is not limited to, logical relationships such as serial execution and parallel execution.
[0053] In one optional embodiment, considering the execution efficiency of file generation tasks, which is typically affected by the current resource allocation of the resource calling system, the resource calling system can execute multiple file generation tasks simultaneously to improve efficiency. Conversely, if the resource calling system has sufficient resources, it indicates a low-load state and the ability to handle high-concurrency tasks. In this case, the resource calling system can execute multiple file generation tasks sequentially according to their priority to ensure stability. Therefore, to improve system resource utilization and execution efficiency while smoothly executing file generation tasks, ensuring each task receives sufficient resources, avoiding resource contention, and maintaining stable system operation, the resource calling system can first determine the task instruction logic for any given file generation task based on historical resource call parameters. This determines the execution order of different file generation tasks, ensuring the rationality of resource allocation and balancing resource usage with processing efficiency.
[0054] For example, if historical resource call parameters show that the resource call system is in a low-peak period and system resource consumption is relatively low, then the corresponding task execution logic can be determined to control multiple file generation tasks to be executed in parallel, so as to make full use of idle resources and improve the processing efficiency of file generation tasks. On the other hand, if historical resource call parameters show that the resource call system is in a high-peak period and system resource usage is close to the limit, then the corresponding task execution logic can be determined to control these multiple file generation tasks to be executed sequentially, so as to avoid excessive resource consumption and ensure system stability and security.
[0055] Step S106: Evaluate the file generation task based on space usage parameters and task execution logic to obtain task evaluation results.
[0056] The task evaluation result is used to characterize whether the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic.
[0057] In one optional solution of this embodiment, considering that if the storage space available to the storage unit is limited, the resource calling system may not have enough space to store the newly generated file when generating the corresponding target file according to the file generation task, which may cause the file generation task to fail or be interrupted. This will also lead to the waste of system resources consumed in the target file generation process, resulting in a decline in user experience, ineffective use of system resources, and even affecting the overall stability and reliability of the system.
[0058] Therefore, after determining the task execution logic of the file generation task, the resource call system can also evaluate the file generation task based on the space usage parameters of the storage unit and the task execution logic of the text generation task. This will determine whether the storage unit still has enough space to store the target file corresponding to the file generation task when the file generation task is executed according to the corresponding task execution logic, so as to ensure that the user can successfully call the target file from the storage unit.
[0059] For example, if the resource allocation system determines that the file generation task is suitable for parallel execution, but the storage unit's space usage parameters show that the remaining space is insufficient to store the total number of target files to be generated, then the task evaluation results will instruct the resource allocation system to either adjust the task execution logic, such as switching to serial execution to alleviate storage pressure, or to clean up expired or no longer needed files in advance to free up enough space to ensure that the file generation task can be completed smoothly and that the storage unit will not affect normal function due to capacity issues.
[0060] Step S108: When the task evaluation result indicates that the storage unit is able to store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic, the file generation task is executed based on the task execution logic to obtain the target file.
[0061] In one optional embodiment, if the task evaluation result shows that the storage unit has enough space to store the target file corresponding to the file generation task when the file generation task is executed according to the corresponding task execution logic, then the resource calling system can allocate corresponding system resources for the file generation task to execute the text generation task according to the task execution logic and obtain the target file mentioned above.
[0062] In this embodiment of the invention, when at least one file generation task is received, the following methods are employed: historical resource call parameters of the resource call system and space usage parameters of the storage unit are obtained; based on the historical resource call parameters, the task execution logic for any file generation task is determined; the file generation task is evaluated based on the space usage parameters and the task execution logic to obtain a task evaluation result; if the task evaluation result indicates that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic, the file generation task is executed based on the task execution logic to obtain the target file. By combining the historical resource call parameters of the resource call system to determine the task execution logic of the file generation task, and combining the space usage parameters of the storage unit with the task execution logic, it is determined that the storage unit can stably store and output the target file corresponding to the file generation task. This effectively ensures the rationality of resource allocation by the resource call system for file generation tasks, avoiding resource waste due to insufficient storage space or excessive load on the resource call system. This improves the resource call system's ability to allocate resources for file generation tasks, thereby solving the technical problem of poor system resource access during the execution of different file generation tasks to generate target files in related technologies.
[0063] Furthermore, the file generation task is evaluated based on space usage parameters and task execution logic to obtain task evaluation results, including: estimating the file storage space corresponding to the file generation task based on the task execution logic, wherein the file storage space is used to characterize the storage space required by the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic; determining the space usage threshold corresponding to the storage unit based on the space usage parameters, wherein the space usage threshold is used to characterize the maximum storage space that the storage unit can provide for the target file under preset storage conditions; and determining the task evaluation result when the file storage space is less than the space usage threshold, indicating that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic.
[0064] In one optional embodiment, to accurately evaluate the file generation task and determine whether the storage unit has sufficient space to store the corresponding target file during the execution of the file generation task, the resource retrieval system can first estimate the file storage space corresponding to the file generation task according to the task execution logic, that is, determine the storage space required by the target file during the execution of the file generation task according to the task execution logic. Then, the resource retrieval system can determine the corresponding space usage threshold based on the obtained storage unit space usage parameters, that is, determine the maximum storage space that can be provided for the target file under preset storage conditions. The preset storage conditions can refer to the storage unit's ability to stably store the target file and stably output the target file upon receiving a file retrieval instruction, ensuring a good user experience when viewing the target file.
[0065] Correspondingly, after determining the maximum storage space that the storage unit can provide for the target file, i.e. the aforementioned space usage threshold, the resource allocation system can compare the target file's storage space with the space usage threshold.
[0066] Therefore, if the comparison result shows that the file storage space is less than the space usage threshold, it indicates that storing the target file using the storage unit can meet the aforementioned preset storage conditions. Correspondingly, it can be determined that the task evaluation result indicates that when executing the file generation task according to the task execution logic, the storage unit can store the target file corresponding to the file generation task. At this point, the resource retrieval system can execute the file generation task according to the task execution logic to obtain the target file and store it in the storage unit.
[0067] If the comparison result shows that the file storage space is greater than or equal to the space usage threshold, it indicates that storing the target file in the storage unit may not meet the aforementioned preset storage conditions. Correspondingly, the task evaluation result indicates that the storage unit cannot store the target file corresponding to the file generation task when executing the file generation task according to the task execution logic. At this point, the resource allocation system can pause the execution of the file generation task and continuously monitor the space changes in the storage unit. Only when the storage unit can store the target file corresponding to the file generation task should the file generation task be executed again. Simultaneously, a prompt message should be output to remind the user of the reason why the file generation task has not been executed, thus avoiding impacting the user experience.
[0068] Furthermore, the preset storage conditions include: read / write speed conditions and data throughput conditions; based on space usage parameters, the space usage threshold corresponding to the storage unit is determined, including: obtaining the target read / write speed corresponding to the read / write speed conditions, and the target throughput corresponding to the data throughput conditions; based on the space usage parameters and the space configuration parameters of the storage unit, the initial usage threshold corresponding to the storage unit is determined; the target read / write speed, target throughput, and initial usage threshold are input into the threshold adjustment model, and the initial usage threshold is adjusted using the threshold adjustment model to obtain the space usage threshold.
[0069] In one optional embodiment, to accurately determine whether the storage unit can stably store the target file and stably output the target file upon receiving a file retrieval instruction, the aforementioned preset storage conditions may include at least: read / write speed conditions and data throughput conditions. For example, if the storage unit's current read / write speed is fast, satisfying the aforementioned read / write speed conditions, and the storage unit's current data throughput is large, satisfying the aforementioned data throughput conditions, then the storage unit can stably store and output the target file. If the storage unit's current read / write speed is slow, not satisfying the aforementioned read / write speed conditions, or the storage unit's current data throughput is small, not satisfying the aforementioned data throughput conditions, then the storage unit cannot stably store and output the target file.
[0070] Furthermore, considering that the storage unit can stably store and output the target file, this can be reflected in the space usage threshold corresponding to the storage unit. Therefore, in determining the space usage threshold corresponding to the storage unit, the resource allocation system can first obtain the target read / write speed corresponding to the read / write speed condition and the target throughput corresponding to the data throughput condition in the preset storage conditions. Next, the resource allocation system can determine the initial usage threshold corresponding to the storage unit based on the obtained space usage parameters and the space configuration parameters of the storage unit, such as the calibrated maximum capacity and the actual usable maximum capacity of the storage unit. That is, the maximum storage space that the storage unit can provide for the target file without considering the preset conditions. Then, in order to ensure that the storage unit can stably store and output the target file, the resource allocation system can further adjust the initial usage threshold using the target read / write speed and target throughput that the storage unit needs to guarantee, thereby obtaining the space usage threshold that ensures the storage unit can stably store and output the target file.
[0071] In order to improve the rationality of the determined space usage threshold, the resource allocation system can adopt an artificial intelligence model to input the target read / write speed, target throughput and initial usage threshold into the corresponding threshold adjustment model, so as to adjust the initial usage threshold using the threshold adjustment model to obtain the space usage threshold.
[0072] Furthermore, the task execution logic includes: parallel execution logic and serial execution logic. Parallel execution logic is used to characterize multi-threaded execution among different file generation tasks, and serial execution logic is used to characterize single-threaded execution among different file generation tasks. Based on historical resource call parameters, the task execution logic for any file generation task is determined, including: inputting historical resource call parameters into the system evaluation model, using the system evaluation model to evaluate the load of the resource call system, and obtaining a status evaluation index; if the status evaluation index is greater than a first preset threshold, the task execution logic is determined to be serial execution logic; if the status evaluation index is less than or equal to the first preset threshold, the task execution logic is determined to be parallel execution logic.
[0073] In one optional embodiment, as described above, to improve the efficiency of executing different file generation tasks while ensuring the stability of the file generation tasks during execution, the task execution logic corresponding to the file generation task may include at least the aforementioned parallel execution logic and serial execution logic. Parallel execution logic refers to the ability of different file generation tasks to be executed using a multi-threaded approach, while serial execution logic refers to the need for different file generation tasks to be executed using a single thread.
[0074] Correspondingly, when determining the task execution logic, the resource call system can first input the obtained historical resource call parameters into the system evaluation model, use the system evaluation model to evaluate the load of the resource call system, and generate corresponding status evaluation indicators. The greater the load of the resource call system, the greater the generated status evaluation indicators.
[0075] After obtaining the status assessment indicators, the resource allocation system can determine that the current load is too high if the indicators exceed a first preset threshold. This indicates that the system may be unable to stably provide system resources for multiple file generation tasks simultaneously. In this case, the execution logic for the file generation tasks can be determined to be serial, using a single thread to improve the stability of the task execution. Conversely, if the status assessment indicators are less than or equal to the first preset threshold, the system can determine that the current load is low and can stably provide system resources for multiple file generation tasks simultaneously. In this case, the execution logic for the file generation tasks can be determined to be parallel, using a multi-threaded approach to improve the efficiency of the task execution.
[0076] Furthermore, the historical resource call parameters include: the first total resource call volume corresponding to different moments in the first historical time period; the above method also includes: obtaining an initial indicator threshold; determining the average execution time of file generation tasks within a first time range based on the historical resource call parameters, wherein the first time range is used to characterize the time range obtained by expanding the target moment, and the target moment is used to characterize the moment when the first total resource call volume reaches the first resource call volume threshold within the first historical time period; obtaining the quotient of the average execution time and the calibration length to obtain a duration quotient value, wherein the calibration length is used to characterize the average execution time of file generation tasks in the second time range of the resource call system, and any moment included in the second time range is before any moment included in the first time range; constructing a first preset threshold based on the duration quotient value and the initial indicator threshold.
[0077] In one optional embodiment, to accurately determine the current load of the resource call system, the system can dynamically determine the aforementioned first preset threshold by combining historical resource call parameters. This allows for flexible determination of the current load, avoiding misjudgments due to a single threshold not matching the actual load of the system. Therefore, to accurately determine the first preset threshold, the historical resource call parameters can include at least the first total resource call volume of the system at different times within a first historical time period, such as the most recent 1 hour or 2 hours.
[0078] Based on this, when determining the first preset threshold, the resource allocation system can first obtain a calibrated initial threshold, namely the aforementioned initial index threshold. Then, based on historical call parameters, it determines the average execution time of file generation tasks within the first time range. This average execution time reflects the time required to execute file generation tasks when the resource allocation system exhibits an overload trend. The first time range characterizes the time range obtained by expanding the target time. The target time characterizes the moment when the first total resource call volume within the first historical time period reaches the first resource call volume threshold. Correspondingly, when the first total resource call volume reaches the first resource call volume threshold, it can be determined that the resource allocation system exhibits an overload trend.
[0079] After determining the average execution time, the resource allocation system can also obtain the average execution time of file generation tasks within a second time range. This is the time required to execute file generation tasks when the resource allocation system is not showing signs of overload. Any point in the second time range is prior to any point in the first time range. After obtaining the calibration time, the resource allocation system can compare the average execution time with the calibration time. The quotient between the two, the aforementioned time quotient value, reflects the change in the time required to execute file generation tasks when the resource allocation system shows signs of overload. Finally, the resource allocation system can use the time quotient value to adjust the initial indicator threshold, thereby constructing a first preset threshold that matches the current usage of the resource allocation system, thus improving the accuracy of using the first preset threshold to determine whether the resource allocation system is overloaded.
[0080] Furthermore, based on the duration quotient and the initial indicator threshold, a first preset threshold is constructed, including: when the duration quotient is greater than the preset quotient, the initial indicator threshold is reduced to obtain the first preset threshold; when the duration quotient is less than or equal to the preset quotient, the initial indicator threshold is increased to obtain the first preset threshold.
[0081] In one optional embodiment, to improve the efficiency of determining the first preset threshold, during the process of adjusting the initial index threshold using the duration quotient to construct the first preset threshold, if the duration quotient is greater than the preset quotient, the initial index threshold can be reduced to obtain the first preset threshold, thereby reducing the number of concurrent tasks in the system under high load, avoiding system overload, and ensuring stable operation when resources are scarce; if the duration quotient is less than or equal to the preset quotient, the initial index threshold can be increased to obtain the first preset threshold, thereby increasing the number of concurrent tasks in the system under low load, making full use of system resources, and improving the processing speed and efficiency of file generation tasks.
[0082] Furthermore, the file generation task is executed based on the task execution logic to obtain the target file, including: when the task execution logic is serial execution logic, obtaining the thread state of the resource call system, and executing the file generation task based on the thread state to obtain the target file, wherein the thread state is used to indicate whether there is a target thread in the resource call system that can execute the file generation task; when the task execution logic is parallel execution logic, obtaining the thread pool state of the resource call system, and executing the file generation task based on the thread pool state to obtain the target file, wherein the thread pool state is used to indicate whether the resource call system can add a new target thread to utilize the target thread to execute the file generation task.
[0083] In one optional embodiment, during the execution of the file generation task according to the execution logic, considering that under serial execution logic, the resource call system typically uses one thread to execute multiple file generation tasks, the resource call system can obtain the current thread state to determine whether there is a target thread capable of executing the file generation task, and then execute the file generation task according to the thread state to obtain the corresponding target file.
[0084] During the execution of file generation tasks according to the execution logic, considering that under serial execution logic, the resource requisition system can use multiple root threads to execute multiple file generation tasks, but too many threads can affect the stability of the resource requisition system in providing system resources for different file generation tasks. Therefore, the resource requisition system can obtain the current thread pool state to determine whether a new target thread can be added to execute the file generation task, and then execute the file generation task according to the thread pool state to obtain the corresponding target file.
[0085] Furthermore, the process of executing a file generation task based on thread state to obtain the target file includes: if a target thread exists in the thread state representation resource call system capable of executing the file generation task, the file generation task is added to the target thread based on its priority, and the target thread is used to execute the file generation task; if no target thread exists in the thread state representation resource call system capable of executing the file generation task, a new target thread is created, and the file generation task is added to the target thread based on its priority, and the target thread is used to execute the file generation task.
[0086] In one feasible solution of this embodiment, when executing a file generation task based on thread status, if the thread status indicates that a target thread exists in the resource retrieval system capable of executing the file generation task, the resource retrieval system can directly utilize the target thread, adding the file generation task to the target thread according to its priority, and then using the target thread to execute the file generation task. If the thread status indicates that no target thread exists in the resource retrieval system capable of executing the file generation task, the resource retrieval system can create a new target thread, adding the file generation task to the target thread based on its priority, and then using the target thread to execute the file generation task.
[0087] Furthermore, the file generation task is executed based on the thread pool state to obtain the target file, including: if the thread pool state indicates that the resource call system can add a new target thread, a new target thread is created, the file generation task is added to the target thread, and the target thread is used to execute the file generation task; if the thread pool state indicates that the resource call system cannot add a new target thread, the file generation task is added to the task waiting queue, and the thread pool state is continuously monitored until the thread pool state indicates that the resource call system can add a new target thread, a new target thread is created, the file generation task is added to the target thread, and the target thread is used to execute the file generation task.
[0088] In one feasible solution of this embodiment, when executing a file generation task based on the thread pool status, if the thread pool status indicates that a new target thread can be added, the resource invocation system can create a new target thread and add the file generation task to the target thread, utilizing the target thread to execute the file generation task, thereby improving the execution efficiency of the file generation task. If the thread pool status indicates that a new target thread cannot be added, the resource invocation system can add the file generation task to the task waiting queue and continuously monitor the thread pool status until the thread pool status indicates that the resource invocation system can add a new target thread. In this case, the new target thread is created, and the file generation task is added to the target thread, utilizing the target thread to execute the file generation task, thus avoiding resource waste and ensuring the execution efficiency of the file generation task is not affected.
[0089] Furthermore, obtaining the thread pool status of the resource invocation system includes: obtaining the number of threads in the resource invocation system that are running; if the number of threads is greater than a preset threshold, determining that the thread pool status indicates that the resource invocation system cannot add new target threads; if the number of threads is less than the preset threshold, determining that the thread pool status indicates that the resource invocation system can add new target threads.
[0090] In one optional embodiment, to accurately obtain the thread pool status of the resource invocation system, the system can first obtain the number of currently running threads. If the number of threads exceeds a preset threshold, it indicates that there is insufficient space to create a new thread pool to execute the corresponding file traversal task. In this case, the resource invocation system can determine that the thread pool status indicates that the system cannot add a new target thread. If the number of threads is less than the preset threshold, it indicates that there is sufficient space to create a new thread pool to execute the corresponding file traversal task. In this case, the resource invocation system can determine that the thread pool status indicates that the system can add a new target thread.
[0091] Furthermore, the above method also includes: obtaining the second total resource call volume of the resource call system at different times in the second historical time period, wherein the start time of the second historical time period is before the start time of the first historical time period; determining at least one third time range from the second historical time period based on the second total resource call volume, wherein the second total resource call volume corresponding to any time in the third time range is greater than the second resource call volume threshold; obtaining the system performance index of the resource call system in any third time range, wherein the system performance index is used to reflect the operation of the resource call system in the third time range; and adjusting the initial quantity threshold based on the system performance index to obtain a preset quantity threshold.
[0092] In one optional embodiment, to flexibly determine whether the resource call system can create new threads, the resource call system can dynamically set a corresponding preset threshold based on the total resource call volume over a historical time period. Correspondingly, the resource call system can first obtain the second total resource call volume at different times within a second historical time period, such as the previous week or month. Then, using the second total resource call volume, it can determine at least one third time range within the second historical time period, i.e., the time period during which the resource call system is in peak task periods and needs to process a large number of tasks. The start of the second historical time period is before the start of the first historical time period, and the second total resource call volume at any time within the third time range is greater than the second resource call volume threshold.
[0093] After determining the third time frame, the resource allocation system can obtain system performance metrics corresponding to any given third time frame. These metrics reflect the system's performance within that time frame, such as determining whether there have been drastic performance fluctuations. Finally, the system can adjust the initial quantity threshold based on the obtained performance metrics to obtain a preset quantity threshold that matches the system's performance during peak periods in historical timeframes. This reflects the system's performance during the current peak period, thereby improving the accuracy of determining whether a new target thread can be added.
[0094] Furthermore, the initial quantity threshold is adjusted based on the system performance index to obtain a preset quantity threshold, including: when the system performance index is greater than a second preset threshold, the initial quantity threshold is reduced to obtain a preset quantity threshold; when the system performance index is less than or equal to the second preset threshold, the initial quantity threshold is increased to obtain a preset quantity threshold.
[0095] In one optional embodiment, during the adjustment of the initial quantity threshold using system performance metrics, if the system performance metrics are greater than a second preset threshold, it indicates that the resource call system may experience significant fluctuations during peak periods, potentially leading to unstable provision of system resources for the file generation task. In this case, the resource call system can decrease the initial quantity threshold to obtain the preset quantity threshold, thereby improving the robustness of determining whether a new target thread can be added. Conversely, if the system performance metrics are less than or equal to the second preset threshold, it indicates that the resource call system may experience significant fluctuations during peak periods, potentially leading to unstable provision of system resources for the file generation task. In this case, the resource call system can increase the initial quantity threshold to obtain the preset quantity threshold, thereby improving the accuracy of determining whether a new target thread can be added.
[0096] Furthermore, the above method also includes: upon receiving a file download instruction input by the user, parsing the file download instruction to obtain at least one file generation task and a file download task; and, if the target file corresponding to the file generation task is stored in a storage unit, outputting the target file based on the file download task using the storage unit.
[0097] In one optional embodiment, considering that the file generation process is usually triggered by a user's need to download data, upon receiving a file download instruction from the user, the resource retrieval system can first parse the file download instruction to obtain at least one file generation task and one file download task. Then, after storing the target file corresponding to the file generation task in a storage unit, the resource retrieval system can further output the target file using the storage unit according to the file download task, thereby improving the user experience.
[0098] For ease of understanding, Figure 2 This is a schematic diagram illustrating a file generation process according to an embodiment of the present invention. Figure 2As shown, during the execution of a file generation task, the resource invocation system can first receive the user's file download instruction to construct at least one corresponding file generation task. After obtaining the file generation task, the resource invocation system can first obtain the total resource invocation volume in the past hour and determine whether the total resource invocation volume exceeds a threshold t. If the total resource invocation volume exceeds the threshold t, it can be determined that the task execution logic of the file generation task is serial execution logic; if the total resource invocation volume does not exceed the threshold t, it can be determined that the task execution logic of the file generation task is parallel execution logic. During the parallel execution logic, the resource invocation system can also obtain the number of threads in the thread pool that are running to determine whether the thread pool has reached its limit. If the thread pool has not reached its limit, the resource invocation system can directly create new threads to execute the file generation task; if the thread pool has reached its limit, the resource invocation system can store the file generation task in the task waiting queue and create new threads to execute the file generation task if the thread pool has not reached its limit.
[0099] After determining the task execution logic for the file generation task, the resource requisition system can further determine the storage unit, such as disk space usage parameters, and determine the maximum storage space that can be reserved for the target file corresponding to the file generation task. If the maximum storage space is greater than the file storage space corresponding to the target file, the resource requisition system can execute the file generation task according to the task execution logic, obtain the target file, and store the target file in the storage unit. If the maximum storage space is less than or equal to the file storage space corresponding to the target file, the resource requisition system can pause the execution of the file generation task until there is enough storage space to store the target file.
[0100] While generating the target file, the resource allocation system can also dynamically adjust the above-mentioned thresholds based on various parameters generated during the file generation process, such as the amount of resources allocated and the execution time of the task, in order to improve the flexibility and rationality of resource allocation.
[0101] It should be noted that the collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0102] In the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used the solution.
[0103] According to an embodiment of the present invention, an apparatus embodiment for a file generation method is provided. It should be noted that the apparatus can be used to execute the above-described file generation method.
[0104] Figure 3 This is a structural block diagram of a document generation apparatus according to an embodiment of the present invention, such as... Figure 3 As shown, the device includes: a parameter acquisition module 302, a logic determination module 304, a task evaluation module 306, and a task execution module 308.
[0105] The parameter acquisition module 302 is used to acquire historical resource call parameters of the resource call system and space usage parameters of the storage unit when at least one file generation task is received. The storage unit is used to store the target file generated based on the file generation task, and the historical resource call parameters are used to reflect the resource call status of the resource call system in the first historical time period. The logic determination module 304 is used to determine the task execution logic of any file generation task based on the historical resource call parameters. The task evaluation module 306 is used to evaluate the file generation task based on the space usage parameters and the task execution logic to obtain a task evaluation result. The task evaluation result is used to characterize whether the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic. The task execution module 308 is used to execute the file generation task based on the task execution logic when the task evaluation result indicates that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic, and obtain the target file.
[0106] Furthermore, the task evaluation module is also used to: estimate the file storage space corresponding to the file generation task based on the task execution logic, wherein the file storage space is used to characterize the storage space required by the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic; determine the space usage threshold corresponding to the storage unit based on the space usage parameter, wherein the space usage threshold is used to characterize the maximum storage space that the storage unit can provide for the target file under preset storage conditions; and determine the task evaluation result when the file storage space is less than the space usage threshold, indicating that the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic.
[0107] Furthermore, the preset storage conditions include: read / write speed conditions and data throughput conditions; the task evaluation module is also used to: obtain the target read / write speed corresponding to the read / write speed conditions, and the target throughput corresponding to the data throughput conditions; determine the initial usage threshold corresponding to the storage unit based on the space usage parameters and the space configuration parameters of the storage unit; input the target read / write speed, target throughput and initial usage threshold into the threshold adjustment model, and use the threshold adjustment model to adjust the initial usage threshold to obtain the space usage threshold.
[0108] Furthermore, the task execution logic includes: parallel execution logic and serial execution logic. The parallel execution logic is used to characterize multi-threaded execution among different file generation tasks, and the serial execution logic is used to characterize single-threaded execution among different file generation tasks. The logic determination module is also used to: input historical resource call parameters into the system evaluation model, use the system evaluation model to evaluate the load of the resource call system, and obtain a status evaluation index; if the status evaluation index is greater than a first preset threshold, determine that the task execution logic is serial execution logic; if the status evaluation index is less than or equal to the first preset threshold, determine that the task execution logic is parallel execution logic.
[0109] Furthermore, the historical resource call parameters include: the first total resource call volume corresponding to different moments in the first historical time period; the above device also includes: a threshold acquisition module for acquiring an initial indicator threshold; a duration determination module for determining the average execution duration of file generation tasks within a first time range based on the historical resource call parameters, wherein the first time range is used to characterize the time range obtained by expanding the target moment, and the target moment is used to characterize the moment when the first total resource call volume reaches the first resource call volume threshold within the first historical time period; a quotient acquisition module for acquiring the quotient between the average execution duration and the calibration duration to obtain a duration quotient value, wherein the calibration duration is used to characterize the average execution duration of file generation tasks in the second time range, and any moment included in the second time range is before any moment included in the first time range; and a threshold construction module for constructing a first preset threshold based on the duration quotient value and the initial indicator threshold.
[0110] Furthermore, the threshold construction module is also used to: reduce the initial indicator threshold to obtain a first preset threshold when the duration quotient is greater than the preset quotient; and increase the initial indicator threshold to obtain a first preset threshold when the duration quotient is less than or equal to the preset quotient.
[0111] Furthermore, the task execution module is also used to: when the task execution logic is serial execution logic, obtain the thread state of the resource call system, and execute the file generation task based on the thread state to obtain the target file, wherein the thread state is used to indicate whether there is a target thread in the resource call system that can execute the file generation task; when the task execution logic is parallel execution logic, obtain the thread pool state of the resource call system, and execute the file generation task based on the thread pool state to obtain the target file, wherein the thread pool state is used to indicate whether the resource call system can add a new target thread to utilize the target thread to execute the file generation task.
[0112] Furthermore, the task execution module is also used to: when there is a target thread in the thread state representation resource call system that can execute the file generation task, add the file generation task to the target thread based on the priority of the file generation task, and use the target thread to execute the file generation task; when there is no target thread in the thread state representation resource call system that can execute the file generation task, create a new target thread, add the file generation task to the target thread based on the priority of the file generation task, and use the target thread to execute the file generation task.
[0113] Furthermore, the task execution module is also used to: when the thread pool state indicates that the resource call system can add a new target thread, create a new target thread, add the file generation task to the target thread, and use the target thread to execute the file generation task; when the thread pool state indicates that the resource call system cannot add a new target thread, add the file generation task to the task waiting queue, and continuously monitor the thread pool state until the thread pool state indicates that the resource call system can add a new target thread, create a new target thread, add the file generation task to the target thread, and use the target thread to execute the file generation task.
[0114] Furthermore, the task execution module is also used to: obtain the number of threads in the resource call system that are running; if the number of threads is greater than a preset threshold, determine that the thread pool status indicates that the resource call system cannot add new target threads; if the number of threads is less than the preset threshold, determine that the thread pool status indicates that the resource call system can add new target threads.
[0115] Furthermore, the aforementioned apparatus further includes: a call volume acquisition module, used to acquire the second total resource call volume of the resource call system at different times in the second historical time period, wherein the start time of the second historical time period is before the start time of the first historical time period; a range determination module, used to determine at least one third time range from the second historical time period based on the second total resource call volume, wherein the second total resource call volume corresponding to any time in the third time range is greater than the second resource call volume threshold; an indicator acquisition module, used to acquire the system performance indicator of the resource call system in any third time range, wherein the system performance indicator is used to reflect the operation of the resource call system in the third time range; and a threshold adjustment module, used to adjust the initial quantity threshold based on the system performance indicator to obtain a preset quantity threshold.
[0116] Furthermore, the threshold adjustment module is also used to: decrease the initial quantity threshold when the system performance index is greater than the second preset threshold to obtain the preset quantity threshold; and increase the initial quantity threshold when the system performance index is less than or equal to the second preset threshold to obtain the preset quantity threshold.
[0117] Furthermore, the above-mentioned device also includes: an instruction parsing module, used to parse the file download instruction input by the user to obtain at least one file generation task and a file download task; and a file output module, used to output the target file based on the file download task by storing the target file corresponding to the file generation task in the storage unit.
[0118] Embodiments of this application also provide an electronic device, including: a memory storing an executable program; and a processor for running the program, wherein the program executes the methods in various embodiments of the present invention during runtime.
[0119] Embodiments of this application also provide a computer-readable storage medium including a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to perform the methods of various embodiments of the present invention.
[0120] Embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the methods of various embodiments of the present invention.
[0121] Embodiments of this application also provide a computer program product, including a non-volatile computer-readable storage medium for storing a computer program that, when executed by a processor, implements the methods in various embodiments of the present invention.
[0122] Embodiments of this application also provide a computer program that, when executed by a processor, implements the methods described in the various embodiments of the present invention.
[0123] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0124] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0125] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0126] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0127] If the integrated unit is implemented as 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 technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0128] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for generating a file, characterized in that, include: Upon receiving at least one file generation task, the system obtains historical resource call parameters of the resource call system and space usage parameters of the storage unit. The storage unit is used to store the target file generated based on at least one file generation task, and the historical resource call parameters are used to reflect the resource call status of the resource call system in the first historical time period. Based on historical resource call parameters, determine the task execution logic for any file generation task; The file generation task is evaluated based on space usage parameters and task execution logic to obtain task evaluation results. The task evaluation results are used to characterize whether the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic. When the task evaluation results represent the execution of the file generation task according to the task execution logic, and the storage unit is able to store the target file corresponding to the file generation task, the file generation task is executed based on the task execution logic to obtain the target file.
2. The method according to claim 1, characterized in that, The file generation task is evaluated based on space usage parameters and task execution logic, yielding task evaluation results, including: Based on the task execution logic, the file storage space corresponding to the file generation task is estimated. The file storage space is used to represent the storage space required by the target file of the file generation task when the file generation task is executed according to the task execution logic. Based on the space usage parameters, the space usage threshold corresponding to the storage unit is determined. The space usage threshold is used to characterize the maximum storage space that the storage unit can provide for the target file under preset storage conditions. When the file storage space is less than the space usage threshold, the task evaluation result indicates that when the file generation task is executed according to the task execution logic, the storage unit can store the target file corresponding to the file generation task.
3. The method according to claim 2, characterized in that, Preset storage conditions include: read / write speed conditions and data throughput conditions; based on space usage parameters, space usage thresholds corresponding to storage units are determined, including: Obtain the target read / write speed corresponding to the read / write speed condition, and the target throughput corresponding to the data throughput condition; Based on space usage parameters and storage unit space configuration parameters, determine the initial usage threshold corresponding to the storage unit; The target read / write speed, target throughput, and initial usage threshold are input into the threshold adjustment model. The initial usage threshold is then adjusted using the threshold adjustment model to obtain the space usage threshold.
4. The method according to claim 1, characterized in that, The task execution logic includes: parallel execution logic and serial execution logic. Parallel execution logic represents multi-threaded execution between different file generation tasks, while serial execution logic represents single-threaded execution between different file generation tasks. Based on historical resource call parameters, the task execution logic for any given file generation task is determined, including: Historical resource call parameters are input into the system evaluation model, and the system evaluation model is used to evaluate the load of the resource call system to obtain status evaluation indicators. If the status evaluation index is greater than the first preset threshold, the task execution logic is determined to be serial execution logic; If the status evaluation index is less than or equal to the first preset threshold, the task execution logic is determined to be parallel execution logic.
5. The method according to claim 4, characterized in that, Historical resource call parameters include: the first total resource call amount corresponding to different moments in the first historical time period; the method also includes: Obtain the initial indicator threshold; Based on historical resource call parameters, the average execution time of file generation tasks within the first time range is determined. The first time range is used to characterize the time range obtained by expanding the target time. The target time is used to characterize the moment when the first total resource call volume within the first historical time period reaches the first resource call volume threshold. The quotient of the average execution time and the calibration time is obtained to get the time quotient value. The calibration time is used to characterize the average execution time of the file generation task of the resource call system in the second time range. Any moment in the second time range is before any moment in the first time range. Based on the duration quotient and the initial indicator threshold, a first preset threshold is constructed.
6. The method according to claim 5, characterized in that, Based on the duration quotient and the initial indicator threshold, a first preset threshold is constructed, including: If the duration quotient is greater than the preset quotient, the initial indicator threshold is reduced to obtain the first preset threshold. If the duration quotient is less than or equal to the preset quotient, the initial indicator threshold is increased to obtain the first preset threshold.
7. The method according to claim 1, characterized in that, Based on the task execution logic, the execution file generates a task, resulting in the target file, including: When the task execution logic is serial execution logic, the thread state of the resource call system is obtained, and the file generation task is executed based on the thread state to obtain the target file. The thread state is used to characterize whether there is a target thread in the resource call system that can execute the file generation task. When the task execution logic is parallel execution logic, the thread pool status of the resource call system is obtained, and the file generation task is executed based on the thread pool status to obtain the target file. The thread pool status is used to indicate whether the resource call system can add a new target thread to use the target thread to execute the file generation task.
8. The method according to claim 7, characterized in that, The file generation task is executed based on the thread state to obtain the target file, including: In a thread state representation resource call system where a target thread exists capable of executing a file generation task, the file generation task is added to the target thread based on its priority, and then the target thread is used to execute the file generation task. If no target thread exists in the thread state representation resource call system that can execute the file generation task, a new target thread is created, and the file generation task is added to the target thread based on the priority of the file generation task, and the target thread is used to execute the file generation task.
9. The method according to claim 7, characterized in that, The file generation task is executed based on the thread pool state to obtain the target file, including: If the thread pool state indicates that the resource call system can add a new target thread, a new target thread is created, the file generation task is added to the target thread, and the file generation task is executed by the target thread. If the thread pool state indicates that the resource calling system cannot add a new target thread, the file generation task is added to the task waiting queue, and the thread pool state is continuously monitored until the thread pool state indicates that the resource calling system can add a new target thread. The new target thread is created, the file generation task is added to the target thread, and the target thread is used to execute the file generation task.
10. The method according to claim 7, characterized in that, Retrieve the thread pool status of the resource access system, including: Get the number of threads that are running in the resource access system; When the number of threads exceeds a preset threshold, the thread pool state indicates that the resource calling system cannot add new target threads. When the number of threads is less than a preset threshold, the thread pool state indicates that the resource calling system can add new target threads.
11. The method according to claim 10, characterized in that, The method also includes: The system obtains the second total resource call volume corresponding to different times in the second historical time period, wherein the start time of the second historical time period is before the start time of the first historical time period. Based on the second total resource call volume, at least one third time range is determined from the second historical time period, wherein the second total resource call volume corresponding to any moment in the third time range is greater than the second resource call volume threshold. Obtain system performance metrics of the resource requisition system within any third time range, where the system performance metrics are used to reflect the operation of the resource requisition system within the third time range; The initial quantity threshold is adjusted based on system performance indicators to obtain the preset quantity threshold.
12. The method according to claim 11, characterized in that, The initial quantity threshold is adjusted based on system performance indicators to obtain a preset quantity threshold, including: If the system performance index is greater than the second preset threshold, the initial quantity threshold is reduced to obtain the preset quantity threshold. If the system performance index is less than or equal to the second preset threshold, the initial quantity threshold is increased to obtain the preset quantity threshold.
13. The method according to claim 1, characterized in that, The method also includes: Upon receiving a file download instruction from the user, the instruction is parsed to obtain at least one file generation task and one file download task. When the target file corresponding to the file generation task is stored in the storage unit, the target file is output using the storage unit based on the file download task.
14. A document generation apparatus, characterized in that, include: The parameter acquisition module is used to acquire historical resource call parameters of the resource call system and space usage parameters of the storage unit when at least one file generation task is received. The storage unit is used to store the target file generated based on the file generation task, and the historical resource call parameters are used to reflect the resource call status of the resource call system in the first historical time period. The logic determination module is used to determine the task execution logic for any file generation task based on historical resource call parameters. The task evaluation module is used to evaluate the file generation task based on space usage parameters and task execution logic, and obtain the task evaluation result. The task evaluation result is used to characterize whether the storage unit can store the target file corresponding to the file generation task when the file generation task is executed according to the task execution logic. The task execution module is used to execute the file generation task according to the task execution logic when the task evaluation result characterizes the file generation task, and the storage unit is able to store the target file corresponding to the file generation task, to obtain the target file.
15. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running a program, wherein the program, when running, performs the method of any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, the device on which the storage medium is located controls the execution of the method of any one of claims 1 to 13.
17. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 13.