Code processing memory allocation method, device, electronic device and readable medium
By introducing memory occupancy information into the code analysis and processing system for adaptive memory allocation, the memory waste and inefficiency caused by inconsistent code volume of code base are solved, and efficient memory utilization and timely progress feedback of code analysis are achieved.
Patent Information
- Application Number
- CN202410503558.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-04-25
Smart Images

Figure CN118312319B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a code processing memory allocation method, device, electronic device, and readable medium. Background Art
[0002] Code processing memory allocation is a technology that allocates processing memory for the code processing process. At present, the code processing memory allocation is usually done by allocating a fixed amount of processing memory to each code base to be analyzed or adaptively allocating processing memory according to the amount of code. In addition, the processing memory can also be adaptively allocated by identifying the overall functional purpose of the code in the code base.
[0003] However, in practice, it is found that when the above method is used to process memory allocation in code, the following technical problems often occur:
[0004] First, because the code size of different code bases is not uniform, and a fixed processing memory is allocated to each code base to be analyzed, it is easy to cause the code base with less code to be allocated more memory, resulting in memory waste;
[0005] Second, it is difficult to measure the memory requirements of the code during the analysis and processing process based solely on the amount of code. As a result, it is easy to occupy more memory and cause memory waste. At the same time, there is a situation where less memory is allocated, making it difficult to perform code analysis. In addition, due to the large number of code files in the code library, it is difficult to provide timely progress feedback on the code analysis results of each code file.
[0006] Third, since there are many code files in the code base that need to be processed, if they are processed one by one, the efficiency will be low. If all are processed in parallel, it will cause server memory overflow, thereby reducing the efficiency of code quality detection.
[0007] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention
[0008] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0009] Some embodiments of the present disclosure propose a code processing memory allocation method, device, electronic device and readable medium to solve one or more of the technical problems mentioned in the above background technology section.
[0010] In a first aspect, some embodiments of the present disclosure provide a method for allocating code processing memory, the method comprising: in response to determining that the analysis engine gateway has received a code analysis request, obtaining a code library to be analyzed, wherein the analysis engine gateway also writes the obtained code library to be analyzed into the database module; in response to detecting that there is a submitted code library to be analyzed in the database module, the analysis engine scheduling node obtains memory occupancy information of the analysis engine working node; the analysis engine scheduling node allocates processing memory to each code library to be analyzed according to the memory occupancy information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware; through the code quality analysis module, code quality detection is performed on the code library to be analyzed in the message queue to generate a code quality detection result; the code quality detection result is sent to the user terminal corresponding to the code analysis request through the message middleware, and the code quality detection result is stored in the code processing result storage module.
[0011] In the second aspect, some embodiments of the present disclosure provide a code processing memory allocation device, which is applied to a code analysis and processing system. The above-mentioned code analysis and processing system includes: an analysis engine gateway, a database module, an analysis engine scheduling node, a message middleware, an analysis engine working node, a code quality analysis module and a code processing result storage module. The device includes: a receiving unit, configured to obtain a code library to be analyzed in response to determining that the analysis engine gateway receives a code analysis request, wherein the analysis engine gateway also writes the obtained code library to be analyzed into the database module; an obtaining unit, configured to obtain memory occupancy information of the analysis engine working node by the analysis engine scheduling node in response to detecting that there is a submitted code library to be analyzed in the database module; a memory allocation unit, configured to allocate processing memory to each code library to be analyzed according to the memory occupancy information by the analysis engine scheduling node, and add the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware; a code quality detection unit, configured to perform code quality detection on the code library to be analyzed in the message queue through the code quality analysis module to generate a code quality detection result; a sending and storage unit, configured to send the code quality detection result to the user terminal corresponding to the code analysis request through the message middleware, and store the code quality detection result in the code processing result storage module.
[0012] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.
[0013] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.
[0014] The above-mentioned various embodiments of the present disclosure have the following beneficial effects: through the code processing memory allocation method of some embodiments of the present disclosure, memory waste can be reduced. The reason for the memory waste is that the code amount of different code bases is not uniform, and a fixed processing memory is allocated to each code base to be analyzed, which easily leads to a code base with a small amount of code being allocated more memory. Based on this, the code processing memory allocation method of some embodiments of the present disclosure is applied to a code analysis processing system, and the above-mentioned code analysis processing system includes: an analysis engine gateway, a database module, an analysis engine scheduling node, a message middleware, an analysis engine working node, a code quality analysis module and a code processing result storage module. First, in response to determining that the above-mentioned analysis engine gateway receives a code analysis request, the code base to be analyzed is obtained. Among them, the above-mentioned analysis engine gateway also writes the obtained code base to be analyzed to the above-mentioned database module. Then, in response to detecting that there is a submitted code base to be analyzed in the above-mentioned database module, the above-mentioned analysis engine scheduling node obtains the memory occupancy information of the above-mentioned analysis engine working node. Here, by introducing the memory occupancy information, it can be used to determine the remaining available memory, so as to facilitate memory allocation. Afterwards, the above-mentioned analysis engine scheduling node allocates processing memory for each code library to be analyzed according to the above-mentioned memory occupancy information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware. Here, by allocating corresponding processing memory to each code library to be analyzed, it can better meet the processing requirements of each code library to be analyzed. At the same time, it avoids the waste of resources caused by excessive memory allocation. Then, through the above-mentioned code quality analysis module, the code library to be analyzed in the message queue is tested for code quality to generate a code quality test result. Among them, the code quality test can be carried out in the allocated memory to obtain the code quality test result. Finally, the above-mentioned code quality test result is sent to the user terminal corresponding to the code analysis request through the above-mentioned message middleware, and the above-mentioned code quality test result is stored in the above-mentioned code processing result storage module. Thus, the analysis and processing process of each code library can be allocated with appropriate memory, so as to greatly avoid memory waste. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0016] Figure 1is a flowchart of some embodiments of the code processing memory allocation method according to the present disclosure;
[0017] Figure 2 is a schematic diagram of the structure of some embodiments of the code processing memory allocation device according to the present disclosure;
[0018] Figure 3 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0019] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0020] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0021] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0024] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0025] Figure 1 The process 100 of some embodiments of the code processing memory allocation method according to the present disclosure is shown. The code processing memory allocation method includes the following steps:
[0026] Step 101: in response to determining that the analysis engine gateway receives a code analysis request, a code library to be analyzed is obtained.
[0027] In some embodiments, the execution subject of the code processing memory allocation method (for example, the above-mentioned code analysis processing system) can obtain the code library to be analyzed in response to determining that the above-mentioned analysis engine gateway receives the code analysis request. Among them, the above-mentioned code analysis processing system may include: an analysis engine gateway, a database module, an analysis engine scheduling node, a message middleware, an analysis engine working node, a code quality analysis module and a code processing result storage module. The above-mentioned analysis engine gateway can also write the acquired code library to be analyzed to the above-mentioned database module. The code analysis request can be information issued by the user end requesting to analyze the code library. Here, the code analysis request can include the website of the code library to be analyzed. Therefore, the code library to be analyzed can be obtained from the website. The code library to be analyzed can be a code platform (including multiple code projects), a single code project or a single code function. Secondly, the analysis engine gateway is an interface for obtaining the code library to be analyzed. The database module can be used to store the code library to be analyzed, as well as the analysis results (i.e., the code quality detection results). The analysis engine call node can be used to schedule the code library to be analyzed to perform analysis processing. The message middleware can be a processing queue for multiple code libraries to be analyzed. The analysis engine working node can generate a running memory for analyzing and processing the code base to be analyzed. The code quality analysis module can be a node for code quality detection. The code processing result storage module can be used to store the analysis and processing results of each code base to be analyzed.
[0028] It should be noted that the above-mentioned computing device can be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or it can be implemented as a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, for example, or it can be implemented as a single software or software module. No specific limitation is made here. It should be understood that the number of computing devices can be any number according to the implementation needs.
[0029] Secondly, the execution subject writes the acquired code library to be analyzed into the database module, which may include the following steps:
[0030] The first step is to create an analysis record corresponding to the code base to be analyzed. The analysis record may include the analysis status corresponding to the code base to be analyzed. The analysis status may represent the analysis progress of the code base to be analyzed. For example, the analysis status may include but is not limited to at least one of the following: unstarted state, analysis state, paused state, ended state, etc.
[0031] The second step is to write the above analysis record and the above code library to be analyzed into the above database module, wherein each analysis record may correspond to a code library to be analyzed.
[0032] Step 102: In response to detecting that there is a submitted code base to be analyzed in the database module, the analysis engine scheduling node obtains memory usage information of the analysis engine working node.
[0033] In some embodiments, the execution subject may, in response to detecting the presence of a submitted code base to be analyzed in the database module, obtain the memory usage information of the analysis engine working node. The analysis engine gateway may also write the obtained code base to be analyzed into the database module. The memory usage information may characterize the memory usage of the analysis engine working node. For example, 50% of the memory is remaining.
[0034] Step 103: the analysis engine scheduling node allocates processing memory to each code base to be analyzed according to the memory usage information, and adds the code base to be analyzed after the processing memory is allocated to the message queue of the message middleware.
[0035] In some embodiments, the analysis engine scheduling node in the execution body allocates processing memory to each code library to be analyzed according to the memory usage information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware.
[0036] In some optional implementations of some embodiments, the above-mentioned memory usage information may include but is not limited to at least one of the following: an idle task queue information set, each idle task queue information including an idle task queue identifier, a task queue memory level and a task queue status. The idle task queues corresponding to each idle task queue information are deployed on at least one server. Each code library to be analyzed may include a code library identifier, a code library processing priority and a code analysis request time point. And the analysis engine scheduling node in the above-mentioned execution body allocates processing memory for each code library to be analyzed according to the above-mentioned memory usage information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware, which may include the following steps:
[0037] The first step is to obtain the historical maximum processing memory corresponding to the code library identifier included in the above-mentioned code libraries to be analyzed from the above-mentioned database module, and obtain the historical maximum processing memory set. Among them, each idle task queue information in the idle task queue information set can correspond to an idle queue in the analysis engine working node. The task queue memory level can be a level pre-divided according to different memory amounts. The task queue state can be a usage status that characterizes the task queue. The code library processing priority can be a preset processing order in the code library. The code analysis request time point can be the time point for obtaining the code library to be analyzed. Here, the historical code library information that is the same as the code library identifier included in each code library to be analyzed in the database module can be obtained. The historical code library information may include the historical maximum allocated memory to characterize the maximum processing memory allocated for code analysis during the historical processing process. Thus, the historical maximum processing memory set is obtained.
[0038] In the second step, based on the code base processing priority and code analysis request time point included in each code base to be analyzed, the task priority corresponding to each code base to be analyzed is determined. Among them, first, the code analysis request time point included in each code base to be analyzed can be quantified. For example, the difference between each code analysis request time point and the time point when the code analysis request is received can be determined as the quantized duration. Then, the code base processing priority (for example, level 1-5) and the quantized duration included in each code base to be analyzed can be weighted and summed to generate a weighted sorting priority value. Finally, the weighted priority value can be used as the task priority. Therefore, each code base to be analyzed can be arranged in the order of weighted priority values. In practice, the weight of the code base processing priority can be much greater than the weight of the code analysis request time point.
[0039] The third step is to allocate an idle task queue to each code base to be analyzed based on the task queue memory level and the determined task priority included in the idle task queue information in the memory usage information. Among them, an idle task queue can be allocated to each code base to be analyzed in order of task priority. Here, the task queue memory level corresponding to the allocated idle task queue should be slightly larger than the historical maximum allocated memory corresponding to the code base to be analyzed. This avoids memory overflow.
[0040] The fourth step is to allocate processing memory to each code base to be analyzed according to the task queue memory level corresponding to the idle task queue, remove the allocated idle task queue information from the idle task queue information set, and modify the task queue state in the allocated idle task queue information from the idle state to the task initial state. Among them, each idle task queue information can correspond to an idle task queue. Secondly, the corresponding processing memory can be allocated to each code base to be analyzed according to the task queue memory level.
[0041] The fifth step is to add the code base to be analyzed after the allocated processing memory to the message queue of the message middleware.
[0042] Optionally, before the execution subject performs code quality detection on the received code library to be analyzed through the code quality analysis module to generate a code quality detection result, the following steps may be performed:
[0043] The first step is to create a scheduled task corresponding to each allocated idle task queue. Among them, the scheduled task may include but is not limited to at least one of the following subtasks: task start status query, task end status query, task status update, task failure processing, task scheduling status query, task cleanup query, task variable modification, and task loss processing. Specifically, the scheduled task may be a scheduled task. Here, the task start status query may be a scheduled task that queries whether the code library to be analyzed is in the start state. The task end status query may be a scheduled task that queries whether the code library to be analyzed is in the end state. The task status update may be a scheduled task that queries whether the task status of the code library to be analyzed has changed. Task failure processing may be a scheduled task that detects whether the task of the code library to be analyzed is in a failed state. The task scheduling status query may be a scheduled task that queries whether the task of the code library to be analyzed is in a task scheduling state. The task cleanup query may be a scheduled task that queries whether the task of the code library to be analyzed needs to be cleaned up. Task variable modification may be a scheduled task that queries whether the global variables of the code library to be analyzed during the task analysis process need to be modified. Task loss processing may be a scheduled task that queries whether the code library to be analyzed is in a task loss state. In practice, the task status in the scheduled task does not conflict with the task status corresponding to the idle task queue.
[0044] In the second step, for each assigned idle task queue, perform the following steps:
[0045] Step 1, obtaining a same-node task information group that matches the above-mentioned allocated idle task queue from the above-mentioned database module. Among them, each of the above-mentioned same-node task information can represent the idle task queue information under the same server. Each server includes a total amount of memory processing resources. Here, matching means that each same-node task information corresponds to the same server as the idle task queue.
[0046] Step 2: determine the historical memory allocation records of each same-node task information in the above same-node task information group to obtain a historical memory allocation record group, wherein each historical memory allocation record may represent the processing memory allocated to the idle task queue in history.
[0047] Step three, in response to determining that the historical maximum processing memory corresponding to the above-mentioned allocated idle task queue is less than the difference between the total amount of memory processing resources of the server and each historical memory allocation record in the above-mentioned historical memory allocation record group, start the code quality detection of the above-mentioned allocated idle task queue. Among them, the task state corresponding to the above-mentioned allocated idle task queue is modified to the task allocation state. Here, the historical maximum processing memory corresponding to the above-mentioned allocated idle task queue is less than the difference between the total amount of memory processing resources of the server and each historical memory allocation record in the above-mentioned historical memory allocation record group, which can indicate that the server has enough memory to allocate to the idle task queue.
[0048] The third step is to delay the code quality detection of the above-mentioned allocated idle task queue in response to determining that the historical maximum processing memory corresponding to the above-mentioned allocated idle task queue is greater than or equal to the difference between the total amount of memory processing resources of the server and each historical memory allocation record in the above-mentioned historical memory allocation record group. Among them, the task state corresponding to the above-mentioned allocated idle task queue can be modified to a task delay state. Here, the historical maximum processing memory corresponding to the above-mentioned allocated idle task queue, greater than or equal to the total amount of memory processing resources of the server and the difference between each historical memory allocation record in the above-mentioned historical memory allocation record group, can characterize the lack of memory of the server, and it is difficult to allocate the required memory for the idle task queue. Therefore, it is necessary to suspend the task and wait for other tasks in the queue to process and release the memory before processing.
[0049] The above step 103 and its related contents, as an inventive point of an embodiment of the present disclosure, solve the second technical problem mentioned in the background technology, "It is difficult to measure the memory requirements of the code in the analysis and processing process only by the amount of code, and thus, it is easy to occupy more memory and cause memory waste. At the same time, there is less memory allocation, which makes it difficult to perform code analysis. In addition, due to the large number of code files in the code base, it is difficult to provide timely progress feedback for the code analysis results of each code file." The factors that make it difficult to provide timely progress feedback for the code analysis results of each code file are often as follows: It is difficult to measure the memory requirements of the code in the analysis and processing process only by the amount of code, and thus, it is easy to occupy more memory and cause memory waste. At the same time, there is less memory allocation, which makes it difficult to perform code analysis. In addition, due to the large number of code files in the code base, it is difficult to provide timely progress feedback for the code analysis results of each code file. If the above factors are solved, code analysis can be performed in a timely manner, and progress feedback can be provided for the code analysis results of each code file in a timely manner. In order to achieve this effect, first of all, considering that different idle task queues may be deployed on different servers, if memory is directly allocated according to levels, some servers may have insufficient memory. Therefore, for each allocated space task queue, by determining the historical memory allocation record of the same-node task information in the matching same-node task information group, it can be used to determine whether the server memory is sufficient to meet the memory allocation based on historical data. Also, because it is determined whether the server memory is sufficient by means of historical memory allocation records, it is not necessary to determine the amount of code. Therefore, the memory usage can be reduced. Therefore, even if there are many code files in the code base, code analysis can be efficiently performed on each code file. In addition, by introducing a timed task, it can be used to regularly update the status of the idle task queue during the code analysis process. This facilitates timely progress feedback.
[0050] Step 104: Perform code quality detection on the code base to be analyzed in the message queue through the code quality analysis module to generate a code quality detection result.
[0051] In some implementations, the execution entity may perform code quality detection on the code library to be analyzed in the message queue through the code quality analysis module to generate a code quality detection result.
[0052] In some optional implementations of some embodiments, the execution subject performs code quality detection on the code library to be analyzed in the message queue through the code quality analysis module to generate a code quality detection result, which may include the following steps:
[0053] In the first step, for each received code library to be analyzed, in response to determining that the task state of the idle task queue corresponding to the received code library to be analyzed is a task allocation state, the following steps are performed:
[0054] Step one, initialize the task manager corresponding to the above-mentioned received code library to be analyzed, obtain the initialized task manager, and determine whether the historical analysis data of the above-mentioned received code library to be analyzed can be used during the initialization process. Among them, the task allocation status can indicate that the code library to be analyzed has allocated memory and can enter the code analysis stage. Secondly, the initialization task manager can be to initialize the parameters in the pre-built task processing class function script, and clone the code library to be analyzed into the task analysis instance. In practice, determining whether the historical analysis data of the above-mentioned received code library to be analyzed can be used can be to determine whether the received code library to be analyzed has been modified. If no modification has been made, the historical analysis data can be used. If modification has been made, the historical analysis data cannot be used. Here, if it can be used, the historical analysis data can be directly determined as the code quality detection result of the code library to be analyzed.
[0055] Step 2: In response to determining that the above historical analysis data cannot be used, the above initialization task manager is used to perform task splitting on the above received code base to be analyzed to generate a sequence of split code subtask groups. Each split code subtask group in the above split code subtask group sequence can include multiple split code subtasks that can be analyzed in parallel, and each split code subtask group performs serial analysis.
[0056] Step three, through the above-mentioned initialization task manager, each split code subtask group in the above-mentioned split code subtask group sequence is analyzed in parallel to generate code parallel analysis results, and a set of code parallel analysis result groups is obtained. Among them, each code parallel analysis result in the above-mentioned code parallel analysis result group set includes: sub-file code equivalent, code file user information, and sub-file code syntax tree node. Secondly, parallel analysis can be to calculate the sub-file code equivalent of each split code subtask, and search for code file user information and sub-file code syntax tree nodes to obtain code parallel analysis results. Here, the code file user information may include but is not limited to: user name, user ID, file path, file node and other information. The sub-file code syntax tree node can be a node of the sub-file in the unified abstract syntax tree.
[0057] Step 4: Through the above-mentioned initialization task manager, a task executor corresponding to each split code subtask group is established to perform code quality detection on each split code subtask in each split code subtask group in the above-mentioned split code subtask group sequence to generate a code subtask detection information group set. Among them, the task executor is composed of multiple processes, and each process processes a split code subtask.
[0058] The second step is to determine the code subtask detection information group set corresponding to each received code base to be analyzed and the above-mentioned code parallel analysis result group set as the code quality detection result, and adjust the task status using the corresponding scheduled task. Among them, the task status can be adjusted to the task end state by querying the task end state in the scheduled task at a predetermined time interval.
[0059] Optionally, the received code library to be analyzed may further include: a code sub-file group. The execution subject performs task splitting on the received code library to be analyzed to generate a sequence of split code sub-task groups, which may include the following steps:
[0060] The first step is to determine the code topology sequence identifiers of each code sub-file in the received code library to be analyzed, and obtain a code topology sequence identifier group. The code topology sequence identifier can represent the topological order of the code sub-file in the overall project. Secondly, the code topology sequence identifier can be obtained from the address of the code library to be analyzed.
[0061] In the second step, the code sub-files in the code sub-file group are split according to the code topology sequence identifier group to obtain a first set of split sub-file groups. The file splitting can be performed according to the code topology sequence identifiers in the code topology sequence identifier group. During the splitting process, multiple code sub-files with similar code topology sequence identifiers are split into a group. In this way, the logical changes between adjacent code sub-files are ensured to be minimal, which is convenient for data caching and inheritance.
[0062] The third step is to split each code subfile according to the file storage capacity of each code subfile in the above code subfile group to obtain a set of subfile groups after the second split. The file splitting can be performed on each code subfile in the above code subfile group in a random manner. During the splitting process, the constraint condition of file balance needs to be met. The constraint condition of file balance can be used to greatly average the data volume of each first split subfile group after splitting. Thus, it is convenient for each first split subfile group to spend as much time as possible in parallel analysis. Thereby, the efficiency of parallel execution is improved.
[0063] The fourth step is to determine each first split sub-file group or second split sub-file group in the first split sub-file group set and the second split sub-file group set as a split code sub-task group to obtain a split code sub-task group sequence. Here, splitting files in two ways can facilitate distributed computing to improve the efficiency of code analysis.
[0064] Optionally, the execution subject performs code quality detection on each split code subtask in each split code subtask group in the split code subtask group sequence to generate a code subtask detection information group set, which may include the following steps:
[0065] The first step is to perform target type detection on each split code subtask in each split code subtask group in the above split code subtask group sequence to generate a code target type detection information group set. Among them, it can be detected from the split code subtask whether there is a target function type. If it exists, the target function type is determined as the code target type detection information.
[0066] As an example, the target function type may be: Cherry-pick (branch replacement) command.
[0067] The second step is to perform function duplication detection on each split code subtask in each split code subtask group in the above split code subtask group sequence to generate a code duplication submission information group set. Among them, the number of repeated submissions of functions in the split code subtask can be detected as the code duplication submission information. Here, the code duplication submission can be the number of repeated occurrences in each split code subtask.
[0068] The third step is to perform static coverage testing on each of the split code subtasks based on the above-mentioned code parallel analysis result group set to generate a code static coverage group set. Among them, the sub-file code syntax tree nodes included in each code parallel analysis result can be used to build a function call relationship graph. Then, according to the test file path pre-configured by the user end, the scope of the test file and the test function is determined. After that, the functions within the test function range, that is, the called functions, are determined in the function call relationship graph. Finally, the ratio of the number of called functions to the number of uncalled functions can be determined as the code static coverage.
[0069] The fourth step is to perform code comment coverage detection on each split code subtask based on the above code parallel analysis result group set to generate a code comment coverage group set. For each split code task, the number of lines with comments in the above split code task can be determined from the sub-file code syntax tree nodes included in the corresponding code parallel analysis results. Then, the ratio of each function with a number of commented lines greater than zero to all functions (in the above split code task) can be determined as the code comment coverage.
[0070] The fifth step is to perform code reuse detection on each split code subtask based on the above-mentioned code parallel analysis result group set to generate a code reuse group set. Among them, for each split code subtask, the similarity between each function and the functions in other split code subtasks can be calculated in the sub-file code syntax tree node in its corresponding code parallel analysis result through the local sensitivity hash algorithm. Then, if the similarity is greater than a preset threshold (for example, 0.7), it is determined to be a repeated function. Finally, the ratio of the number of non-repeated functions in the split code subtask to the total number of functions can be determined as the code reuse.
[0071] The sixth step is to generate a code subtask detection information group set using the above-mentioned code target type detection information group set, the above-mentioned code duplicate submission information group set, the above-mentioned code static coverage group set, the above-mentioned code comment coverage group set and the above-mentioned code reuse group set. In practice, for each code sub-file, its corresponding code target type detection information, the above-mentioned code duplicate submission information, the above-mentioned code static coverage, the above-mentioned code comment coverage and the above-mentioned code reuse can be calculated. The corresponding code target type detection information, the above-mentioned code duplicate submission information, the above-mentioned code static coverage, the above-mentioned code comment coverage and the above-mentioned code reuse can also be calculated from the dimensions of each code sub-file group. No specific limitation is made here.
[0072] The above step 104 and its related contents, as an inventive point of an embodiment of the present disclosure, solve the technical problem three mentioned in the background technology: "Since there are many code files in the code base that need to be processed, if they are processed sequentially, the efficiency is low, and if all are processed in parallel, it will cause the server memory overflow, thereby reducing the efficiency of code quality detection". The factors that lead to the reduction of the efficiency of code quality detection are often as follows: Since there are many code files in the code base that need to be processed, if they are processed sequentially, the efficiency is low, and if all are processed in parallel, it will cause the server memory overflow. If the above factors are solved, the efficiency of code quality detection can be improved. In order to achieve this effect, first, by setting a task manager, it is convenient to schedule tasks. At the same time, because the task executor corresponding to each split code subtask group is established through the task manager, it is convenient for multiple processes to process each split code subtask. Here, considering the problem that all parallel processing easily leads to server memory overflow, the task is split in two different ways to facilitate task distributed computing. Specifically, because task queues and priorities are assigned to each code base to be analyzed in advance, the analysis tasks can be executed in an orderly manner while ensuring that the server memory is sufficient. At the same time, in order to further improve the efficiency of code quality detection, the code parallel analysis result group set generated by parallel analysis is used in the code quality detection process to improve the detection efficiency. Finally, through multi-dimensional detection, the accuracy of code quality detection is improved on the basis of improving the efficiency of code quality detection.
[0073] Step 105: Send the code quality detection result to the user terminal corresponding to the code analysis request through the message middleware, and store the code quality detection result in the code processing result storage module.
[0074] In some embodiments, the execution entity may send the code quality detection result to a user terminal corresponding to the code analysis request through the message middleware, and store the code quality detection result in the code processing result storage module.
[0075] Optionally, the analysis engine gateway includes a code analysis request receiving module and a code processing result query module, the code analysis request receiving module includes a code analysis request interface, the code processing result query module includes a code processing result query interface, and the analysis engine gateway receives the code analysis request through the code analysis request interface of the code analysis request receiving module; and the execution subject may also perform the following steps:
[0076] In response to determining that the code processing result query interface of the code processing result query module receives a code query request, the corresponding code quality detection result is called from the code processing result storage module, and the code quality detection result is sent to the user terminal corresponding to the code query request.
[0077] The above-mentioned various embodiments of the present disclosure have the following beneficial effects: through the code processing memory allocation method of some embodiments of the present disclosure, memory waste can be reduced. The reason for the memory waste is that the code amount of different code bases is not uniform, and a fixed processing memory is allocated to each code base to be analyzed, which easily leads to a code base with a small amount of code being allocated more memory. Based on this, the code processing memory allocation method of some embodiments of the present disclosure is applied to a code analysis processing system, and the above-mentioned code analysis processing system includes: an analysis engine gateway, a database module, an analysis engine scheduling node, a message middleware, an analysis engine working node, a code quality analysis module and a code processing result storage module. First, in response to determining that the above-mentioned analysis engine gateway receives a code analysis request, the code base to be analyzed is obtained. Among them, the above-mentioned analysis engine gateway also writes the obtained code base to be analyzed to the above-mentioned database module. Then, in response to detecting that there is a submitted code base to be analyzed in the above-mentioned database module, the above-mentioned analysis engine scheduling node obtains the memory occupancy information of the above-mentioned analysis engine working node. Here, by introducing the memory occupancy information, it can be used to determine the remaining available memory, so as to facilitate memory allocation. Afterwards, the above-mentioned analysis engine scheduling node allocates processing memory for each code library to be analyzed according to the above-mentioned memory occupancy information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware. Here, by allocating corresponding processing memory to each code library to be analyzed, it can better meet the processing requirements of each code library to be analyzed. At the same time, it avoids the waste of resources caused by excessive memory allocation. Then, through the above-mentioned code quality analysis module, the code library to be analyzed in the message queue is tested for code quality to generate a code quality test result. Among them, the code quality test can be carried out in the allocated memory to obtain the code quality test result. Finally, the above-mentioned code quality test result is sent to the user terminal corresponding to the code analysis request through the above-mentioned message middleware, and the above-mentioned code quality test result is stored in the above-mentioned code processing result storage module. Thus, the analysis and processing process of each code library can be allocated with appropriate memory, so as to greatly avoid memory waste.
[0078] Further references Figure 2 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a code processing memory allocation device, and these device embodiments are similar to Figure 1Corresponding to the method embodiments shown, the code processing memory allocation device can be specifically applied to a code analysis processing system. The above code analysis processing system may include: an analysis engine gateway, a database module, an analysis engine scheduling node, a message middleware, an analysis engine working node, a code quality analysis module and a code processing result storage module.
[0079] like Figure 2 As shown, the code processing memory allocation device 200 of some embodiments includes: a receiving unit 201, an acquiring unit 202, a memory allocation unit 203, a code quality detection unit 204 and a sending and storage unit 205. Among them, the receiving unit 201 is configured to obtain the code library to be analyzed in response to determining that the above-mentioned analysis engine gateway has received the code analysis request, wherein the above-mentioned analysis engine gateway also writes the obtained code library to be analyzed into the above-mentioned database module; the obtaining unit 202 is configured to obtain the memory occupancy information of the above-mentioned analysis engine working node in response to detecting that there is a submitted code library to be analyzed in the above-mentioned database module; the memory allocation unit 203 is configured to allocate processing memory to each code library to be analyzed according to the above-mentioned memory occupancy information by the above-mentioned analysis engine scheduling node, and add the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware; the code quality detection unit 204 is configured to perform code quality detection on the code library to be analyzed in the message queue through the above-mentioned code quality analysis module to generate a code quality detection result; the sending and storage unit 205 is configured to send the above-mentioned code quality detection result to the user terminal corresponding to the code analysis request through the above-mentioned message middleware, and store the above-mentioned code quality detection result in the above-mentioned code processing result storage module.
[0080] It is understood that the units described in the device 200 are similar to those described in the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 200 and the units included therein, and will not be described in detail here.
[0081] Reference below Figure 3 , which shows a structural schematic diagram of an electronic device (eg, a computing device) 300 suitable for implementing some embodiments of the present disclosure. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0082] like Figure 3As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory 302 or a program loaded from a storage device 308 into a random access memory 303. Various programs and data required for the operation of the electronic device 300 are also stored in the random access memory 303. The processing device 301, the read-only memory 302, and the random access memory 303 are connected to each other via a bus 304. An input / output interface 305 is also connected to the bus 304.
[0083] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0084] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the read-only memory 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0085] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0086] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0087] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: in response to determining that the analysis engine gateway receives a code analysis request, obtains the code library to be analyzed, wherein the analysis engine gateway also writes the obtained code library to be analyzed into the database module; in response to detecting that there is a submitted code library to be analyzed in the database module, the analysis engine scheduling node obtains the memory occupancy information of the analysis engine working node; the analysis engine scheduling node allocates processing memory for each code library to be analyzed according to the memory occupancy information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware; through the code quality analysis module, the code library to be analyzed in the message queue is tested for code quality to generate a code quality test result; the code quality test result is sent to the user terminal corresponding to the code analysis request through the message middleware, and the code quality test result is stored in the code processing result storage module.
[0088] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0089] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0090] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be arranged in a processor, for example, may be described as: a processor includes a receiving unit, an acquisition unit, a memory allocation unit, a code quality detection unit, and a sending and storage unit. Among them, the names of these units do not constitute a limitation on the units themselves in some cases, for example, the receiving unit may also be described as a "unit that receives a code analysis request".
[0091] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0092] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A code processing memory allocation method, which is applied to a code analysis processing system, the code analysis processing system comprising: Analysis engine gateway, database module, analysis engine scheduling node, message middleware, analysis engine working node, code quality analysis module and code processing result storage module, wherein: In response to determining that the analysis engine gateway receives the code analysis request, obtaining a code library to be analyzed, wherein the analysis engine gateway also writes the obtained code library to be analyzed into the database module; In response to detecting that there is a submitted code base to be analyzed in the database module, the analysis engine scheduling node obtains memory usage information of the analysis engine working node, wherein the analysis engine working node generates a running memory for analyzing and processing the code base to be analyzed; The analysis engine scheduling node allocates processing memory to each code library to be analyzed according to the memory usage information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware; Through the code quality analysis module, code quality detection is performed on the code library to be analyzed in the message queue to generate a code quality detection result; Sending the code quality detection result to the user terminal corresponding to the code analysis request through the message middleware, and storing the code quality detection result in the code processing result storage module; The memory usage information includes: an idle task queue information set, each idle task queue information includes an idle task queue identifier, a task queue memory level, and a task queue state, the idle task queue corresponding to each idle task queue information is deployed on at least one server, and each code library to be analyzed includes a code library identifier, a code library processing priority, and a code analysis request time point; and The analysis engine scheduling node allocates processing memory to each code library to be analyzed according to the memory usage information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware, including: Acquire the historical maximum processing memory corresponding to the code library identifier included in each of the code libraries to be analyzed from the database module to obtain a historical maximum processing memory set; Determine the task priority corresponding to each code base to be analyzed based on the code base processing priority and code analysis request time point included in each code base to be analyzed; Based on the task queue memory level and the determined task priority included in the idle task queue information in the memory usage information, an idle task queue is allocated to each code base to be analyzed, wherein the task queue memory level corresponding to the allocated idle task queue is greater than the historical maximum processing memory corresponding to the code base to be analyzed; According to the task queue memory level corresponding to the idle task queue, processing memory is allocated to each code base to be analyzed, and the allocated idle task queue information is removed from the idle task queue information set, and the task queue state in the allocated idle task queue information is modified from the idle state to the task initial state, wherein each idle task queue information corresponds to an idle task queue; The code base to be analyzed after the allocated processing memory is added to the message queue of the message middleware.
2. The method according to claim 1, wherein: The analysis engine gateway includes a code analysis request receiving module and a code processing result query module, the code analysis request receiving module includes a code analysis request interface, the code processing result query module includes a code processing result query interface, and the analysis engine gateway receives a code analysis request through the code analysis request interface of the code analysis request receiving module; as well as The method further comprises: In response to determining that the code processing result query interface of the code processing result query module receives a code query request, calling the corresponding code quality detection result from the code processing result storage module, and sending the code quality detection result to a user terminal corresponding to the code query request.
3. The method according to claim 1, wherein: The step of writing the acquired code base to be analyzed into the database module includes: Creating an analysis record corresponding to the code library to be analyzed, wherein the analysis record includes an analysis status corresponding to the code library to be analyzed; The analysis record and the code library to be analyzed are written into the database module.
4. The method according to claim 1, wherein: Before performing code quality detection on the received code library to be analyzed by the code quality analysis module to generate a code quality detection result, the method further includes: Create a scheduled task corresponding to each allocated idle task queue, wherein the scheduled task includes at least one of the following subtasks: task start status query, task end status query, task status update, task failure processing, task scheduling status query, task cleanup query, task variable modification, and task loss processing; For each assigned idle task queue, perform the following steps: Acquire a same-node task information group that matches the allocated idle task queue from the database module, wherein each same-node task information in the same-node task information group represents idle task queue information under the same server, and each server includes a total amount of memory processing resources; Determine the historical memory allocation record of each same-node task information in the same-node task information group to obtain a historical memory allocation record group; In response to determining that the historical maximum processing memory corresponding to the allocated idle task queue is less than the difference between the total amount of memory processing resources of the server and each historical memory allocation record in the historical memory allocation record group, starting the code quality detection of the allocated idle task queue, wherein the task state corresponding to the allocated idle task queue is modified to the task allocation state; In response to determining that the historical maximum processing memory corresponding to the allocated idle task queue is greater than or equal to the difference between the total amount of memory processing resources of the server and each historical memory allocation record in the historical memory allocation record group, the code quality detection of the allocated idle task queue is delayed, wherein the task state corresponding to the allocated idle task queue is modified to a task delayed state.
5. The method according to claim 1, wherein: The code quality analysis module performs code quality detection on the received code base to be analyzed to generate code quality detection results, including: For each received code library to be analyzed, in response to determining that the task state of the idle task queue corresponding to the received code library to be analyzed is a task allocation state, the following steps are performed: Initializing a task manager corresponding to the received code base to be analyzed to obtain an initialized task manager, and determining during the initialization process whether the historical analysis data of the received code base to be analyzed can be used; In response to determining that the historical analysis data cannot be used, using the initialization task manager, the received code base to be analyzed is split into tasks to generate a split code subtask group sequence, wherein each split code subtask group in the split code subtask group sequence includes a plurality of split code subtasks that can be analyzed in parallel, and each split code subtask group is analyzed serially; Through the initialization task manager, each split code subtask group in the split code subtask group sequence is analyzed in parallel to generate a code parallel analysis result, and a code parallel analysis result group set is obtained, wherein each code parallel analysis result in the code parallel analysis result group set includes: sub-file code equivalent, code file user information, and sub-file code syntax tree node. The parallel analysis is to determine the sub-file code equivalent of each split code subtask, and search for the code file user information and the sub-file code syntax tree node to obtain the code parallel analysis result; By means of the initialization task manager, a task executor corresponding to each split code subtask group is established to perform code quality detection on each split code subtask in each split code subtask group in the split code subtask group sequence, so as to generate a code subtask detection information group set, wherein the task executor is composed of multiple processes, and each process processes one split code subtask; The code subtask detection information group set corresponding to each received code library to be analyzed and the code parallel analysis result group set are determined as code quality detection results, and the task status is adjusted using the corresponding scheduled task.
6. The method according to claim 5, wherein: The received code base to be analyzed also includes: a code sub-file group; and The step of performing task splitting on the received code base to be analyzed to generate a sequence of split code subtask groups includes: Determine the code topology sequence identifier of each code sub-file in the received code library to be analyzed, and obtain a code topology sequence identifier group; According to the code topology sequence identification group, each code sub-file in the code sub-file group is split to obtain a first split sub-file group set; According to the file storage capacity of each code sub-file in the code sub-file group, each code sub-file is split to obtain a second split sub-file group set; Each first split sub-file group or second split sub-file group in the first split sub-file group set and the second split sub-file group set is determined as a split code sub-task group to obtain a split code sub-task group sequence.
7. A code processing memory allocation device, which is applied to a code analysis processing system, the code analysis processing system comprising: Analysis engine gateway, database module, analysis engine scheduling node, message middleware, analysis engine working node, code quality analysis module and code processing result storage module, wherein: A receiving unit, configured to obtain a code library to be analyzed in response to determining that the analysis engine gateway receives a code analysis request, wherein the analysis engine gateway also writes the obtained code library to be analyzed into the database module; an acquisition unit, configured to, in response to detecting that there is a submitted code base to be analyzed in the database module, the analysis engine scheduling node acquires the memory usage information of the analysis engine working node, wherein the analysis engine working node generates a running memory for analyzing and processing the code base to be analyzed; A memory allocation unit is configured to allocate processing memory to each code base to be analyzed according to the memory occupancy information by the analysis engine scheduling node, and add the code base to be analyzed after the processing memory is allocated to the message queue of the message middleware; A code quality detection unit is configured to perform code quality detection on the code library to be analyzed in the message queue through the code quality analysis module to generate a code quality detection result; A sending and storage unit, configured to send the code quality detection result to a user terminal corresponding to the code analysis request through the message middleware, and store the code quality detection result in the code processing result storage module; The memory usage information includes: an idle task queue information set, each idle task queue information includes an idle task queue identifier, a task queue memory level, and a task queue state, the idle task queue corresponding to each idle task queue information is deployed on at least one server, and each code library to be analyzed includes a code library identifier, a code library processing priority, and a code analysis request time point; and The analysis engine scheduling node allocates processing memory to each code library to be analyzed according to the memory usage information, and adds the code library to be analyzed after the processing memory is allocated to the message queue of the message middleware, including: Acquire the historical maximum processing memory corresponding to the code library identifier included in each of the code libraries to be analyzed from the database module to obtain a historical maximum processing memory set; Determine the task priority corresponding to each code base to be analyzed based on the code base processing priority and code analysis request time point included in each code base to be analyzed; Based on the task queue memory level and the determined task priority included in the idle task queue information in the memory usage information, an idle task queue is allocated to each code base to be analyzed, wherein the task queue memory level corresponding to the allocated idle task queue is greater than the historical maximum processing memory corresponding to the code base to be analyzed; According to the task queue memory level corresponding to the idle task queue, processing memory is allocated to each code base to be analyzed, and the allocated idle task queue information is removed from the idle task queue information set, and the task queue state in the allocated idle task queue information is modified from the idle state to the task initial state, wherein each idle task queue information corresponds to an idle task queue; The code base to be analyzed after the allocated processing memory is added to the message queue of the message middleware.
8. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
