Code running method and device, computer equipment, storage medium and product

By introducing a container instance pool in the low-code platform, and running custom codes based on the user's concurrent task information and identity information allocated instances, the problem that the operation of custom code in the low-code platform affects resource utilization is solved, and the operation efficiency and resource utilization are improved.

CN119645566APending Publication Date: 2025-03-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In low-code business systems, the operation of user-defined code snippets may affect the low-code runtime process, resulting in reduced resource utilization and low running efficiency.

Method used

By receiving the running instructions of the target user, obtaining concurrent task information and identity information, determining whether the custom code to be run meets the instance allocation conditions, and allocating the instance from the container instance pool based on the instance occupancy information to run the code.

Benefits of technology

It is implemented to isolate the running thread of the code running platform and the running thread of the custom code, improve the efficiency of running custom code, and improve the resource utilization of the container instance pool by reasonably allocating instances.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645566A_ABST
    Figure CN119645566A_ABST
Patent Text Reader

Abstract

The invention relates to a code running method and device, computer equipment, a storage medium and a product. The method comprises the steps of obtaining concurrent task information of a target user at the current moment according to identity information of the target user under the condition that an operation instruction sent by the target user for a to-be-operated custom code is received; according to the concurrent task information and the identity information of the target user, determining whether the custom code to be operated meets an instance distributable condition or not; and if yes, according to the identity information of the target user and the instance occupation information of the custom code, in operation, of the target user, distributing an instance for the custom code to be operated from a container instance pool so as to operate the custom code to be operated. By adopting the method, the resource utilization rate of the low-code platform and the efficiency of running the custom code can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a code running method, apparatus, computer equipment, storage medium and product. Background Art

[0002] In the low-code business system, users can build application interfaces and data models by dragging and dropping components and model-driven logic. The low-code platform allows users to write code snippets in groovy syntax, and then call interfaces based on these code snippets in events or pages. When calling the interface, the low-code platform runtime process is responsible for starting the groovy execution engine to execute the groovy syntax code snippets.

[0003] However, when executing a user's custom business code, if a user's custom code snippet runs at a risk of affecting the low-code runtime process, other users' resources and businesses will also be unable to run, reducing the resource utilization of the low-code platform and the efficiency of running custom code. Summary of the invention

[0004] Based on this, it is necessary to provide a code running method, device, computer equipment, storage medium and product that can improve the resource utilization of the low-code platform and the efficiency of running custom code in response to the above-mentioned technical problems.

[0005] In a first aspect, the present application provides a code execution method, comprising:

[0006] When receiving a running instruction for the custom code to be run sent by the target user, obtaining concurrent task information of the target user at the current moment according to the identity information of the target user;

[0007] Determining whether the to-be-run custom code meets an instance allocatable condition according to the concurrent task information and the identity information of the target user;

[0008] If so, an instance is allocated to the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run.

[0009] In one embodiment, determining whether the target user meets the assignable condition according to the concurrent task information and the identity information of the target user includes:

[0010] Determine the concurrent task amount of the target user at the current moment according to the concurrent task information;

[0011] Determining a concurrent task threshold of the target user according to the identity information of the target user;

[0012] If the concurrent task amount is less than the concurrent task threshold, it is determined that the target user meets the assignable condition.

[0013] In one of the embodiments, allocating an instance for the to-be-run custom code from a container instance pool according to the identity information of the target user and the instance occupancy information of the running custom code of the target user includes:

[0014] According to the identity information of the target user, acquiring instance occupancy information of the running custom code of the target user and a threshold value of the number of instances that can be occupied by the target user;

[0015] According to the instance occupancy information, the instance number threshold, and the identity information, an instance is allocated to the to-be-run custom code from a container instance pool.

[0016] In one of the embodiments, the instance occupancy information includes the instance occupancy number;

[0017] The allocating an instance for the to-be-run custom code from a container instance pool according to the instance occupancy information, the instance number threshold, and the identity information includes:

[0018] If the instance occupancy number is less than the instance number threshold, allocating an idle instance in a container instance pool to the custom code to be run according to the identity information;

[0019] If the number of occupied instances is greater than the instance number threshold, an occupied instance in the container instance pool is allocated to the custom code to be run according to the identity information.

[0020] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level;

[0021] The allocating, according to the identity information, an idle instance in a container instance pool for the custom code to be run includes:

[0022] If the identity information is a first-level user, allocating any idle instance in the first-level container instance pool to the custom code to be run;

[0023] If the identity information is of a second-level user, any idle instance in the second-level container instance pool is allocated to the custom code to be run.

[0024] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level;

[0025] The allocating an occupied instance in the container instance pool to the custom code to be run according to the identity information includes:

[0026] If the identity information is that of a common user, an occupied instance is randomly allocated to the custom code to be run from the first-level container instance pool;

[0027] If the identity information is an important user, then an occupied instance is randomly allocated to the custom code to be run from the occupied instances occupied by the running custom code of the target user in the second-level container instance pool.

[0028] In a second aspect, the present application also provides a code running device, including:

[0029] An information acquisition module, configured to, upon receiving a running instruction for a custom code to be run sent by a target user, acquire concurrent task information of the target user at the current moment according to the identity information of the target user;

[0030] A condition determination module, used to determine whether the custom code to be run meets the instance allocatable condition according to the concurrent task information and the identity information of the target user;

[0031] The code running module is used to allocate an instance to the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run, if the conditions are met.

[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0033] When receiving a running instruction for the custom code to be run sent by the target user, obtaining concurrent task information of the target user at the current moment according to the identity information of the target user;

[0034] Determining whether the to-be-run custom code meets an instance allocatable condition according to the concurrent task information and the identity information of the target user;

[0035] If so, an instance is allocated to the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0037] When receiving a running instruction for the custom code to be run sent by the target user, obtaining concurrent task information of the target user at the current moment according to the identity information of the target user;

[0038] Determining whether the to-be-run custom code meets an instance allocatable condition according to the concurrent task information and the identity information of the target user;

[0039] If so, an instance is allocated to the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run.

[0040] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0041] When receiving a running instruction for the custom code to be run sent by the target user, obtaining concurrent task information of the target user at the current moment according to the identity information of the target user;

[0042] Determining whether the to-be-run custom code meets an instance allocatable condition according to the concurrent task information and the identity information of the target user;

[0043] If so, an instance is allocated to the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run.

[0044] The above code running method, device, computer equipment, storage medium and product, when receiving the running instruction for the custom code to be run sent by the target user, obtain the concurrent task information of the target user at the current moment according to the identity information of the target user; determine whether the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user; if it meets the condition, allocate an instance for the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run. The above scheme, by introducing the container instance pool to run the custom code to be run by the target user in the code running, realizes the isolation between the running thread of the code running platform and the running thread of the custom code, thereby improving the efficiency of running the custom code; further, by determining that the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user, the instance is allocated according to the identity information of the target user and the instance occupancy information, thereby improving the resource utilization rate of the instances in the container instance pool. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0046] Figure 1 An application environment diagram of a code running method in an embodiment;

[0047] Figure 2 A schematic diagram of a flow chart of a code running method in one embodiment;

[0048] Figure 3 A schematic diagram of a process for determining whether a target user meets an assignable condition in one embodiment;

[0049] Figure 4 A schematic diagram of a process for allocating instances to custom codes to be run in one embodiment;

[0050] Figure 5 A schematic diagram of reporting heartbeats to a registration center for users of different identity levels in one embodiment;

[0051] Figure 6 A schematic diagram of a local thread pool task queue in one embodiment;

[0052] Figure 7 It is a schematic diagram of the architecture flow of a low-code platform that introduces a container instance pool in one embodiment;

[0053] Figure 8 A flowchart of a code running method in another embodiment;

[0054] Fig. 9 It is a structural block diagram of a code running device in an embodiment;

[0055] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] The code execution method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 101 communicates with the server 102 through the network. The data storage system can store the data that the server 102 needs to process. The data storage system can be integrated on the server 102, or it can be placed on the cloud or other network servers. Optionally, when the server 102 receives the running instruction for the custom code to be run sent by the target user through the terminal 102, the concurrent task information of the target user at the current moment is obtained according to the identity information of the target user; according to the concurrent task information and the identity information of the target user, it is determined whether the custom code to be run meets the instance allocation condition; if it meets, according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, the instance is allocated from the container instance pool for the custom code to be run to run the custom code to be run. Among them, the terminal 101 can be but not limited to various personal computers, laptops, etc., and the terminal 101 is installed with an application for running code, such as a low-code platform. The server 102 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0058] In an exemplary embodiment, Figure 2 As shown, a code running method is provided, which is applied to Figure 1 The server 102 in the example is used as an example to illustrate, and specifically includes the following steps:

[0059] S201, when receiving a running instruction for a custom code to be run sent by a target user, obtaining concurrent task information of the target user at the current moment according to the identity information of the target user.

[0060] Among them, the target user may be any enterprise or organization on the low-code platform; the custom code is the groovy syntax code customized and edited by the target user; the custom code to be run is the custom code that needs to be run; the run instruction is an instruction used to instruct the running of the custom code to be run on the low-code platform; the identity information of the target user is information that characterizes the identity of the target user. In this embodiment of the present application, the identity information of the target user includes but is not limited to information such as the user ID of the target user, the identity level of the target user, and the permissions of the target user; the concurrent task information at the current moment is the information of the tasks that the target user is running simultaneously using the low-code platform at the current moment.

[0061] Optionally, in a low-code platform, most of the business codes are automatically generated by the low-code platform. However, for personalized businesses, users are allowed to write code snippets in groovy syntax, and the low-code platform runtime process is responsible for executing the code snippets. In traditional technologies, the custom code written by users in groovy syntax generally requires an execution engine to execute, which is called the Groovy execution engine. When users run custom code, they call the interface based on the custom code, and the low-code platform runtime process is responsible for starting the groovy execution engine to execute the custom code in groovy syntax.

[0062] In an embodiment of the present application, a container instance pool is introduced to extract the groovy execution engine from the low-code runtime process environment and run it independently in a container, that is, the custom code is run by the container instance pool.

[0063] Optionally, after the user finishes writing the custom code, the user saves the custom code and clicks the run button, and the server receives the run instruction for the custom code to be run from the target user. Further, the server obtains the concurrent task information of the target user at the current moment according to the identity information of the target user.

[0064] S202, determining whether the custom code to be run meets the instance allocatable condition according to the concurrent task information and the identity information of the target user; if so, executing S203; if not, executing S204.

[0065] The instance allocatable condition is a condition that needs to be met when allocating an instance to be run by the custom code.

[0066] Optionally, the target user's identity information can be used to determine the conditions that the target user needs to meet to run the custom code, such as whether the number of tasks that the target user performs in parallel on the low-code platform exceeds the total number of tasks that the low-code platform allows to run in parallel. Furthermore, based on the concurrent task information and the target user's identity information, it can be determined whether the custom code to be run meets the instance allocatable conditions.

[0067] Optionally, if the custom code to be run meets the instance allocatable condition, an instance can be allocated to the custom code to be run, ie, S203 is executed; otherwise, an instance cannot be allocated to the custom code to be run, ie, S204 is executed.

[0068] S203: Allocate an instance for the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user that is running, so as to run the custom code to be run.

[0069] The instance occupancy information represents the instance occupied by the running custom code of the target user in the container instance pool.

[0070] Optionally, in the embodiment of the present application, in order to provide more targeted services to users, users of the low-code platform can be divided into first-level users and second-level users, with the first level being higher than the second level; for example, first-level users can be important business users, and second-level users can be ordinary trial users. Accordingly, different container instance pools are set for users of different identity levels.

[0071] Optionally, if the custom code to be run meets the instance allocatable condition, the identity level of the target user can be determined based on the identity information of the target user, and the instance occupancy information of the target user's custom code that is running can be comprehensively analyzed, and an instance can be allocated to the custom code to be run from the container instance pool corresponding to the identity level of the target user to run the custom code to be run.

[0072] S204: Do not respond to the operation instruction and generate operation abnormality information.

[0073] In the above code running method, when receiving the running instruction for the custom code to be run sent by the target user, the concurrent task information of the target user at the current moment is obtained according to the identity information of the target user; according to the concurrent task information and the identity information of the target user, it is determined whether the custom code to be run meets the instance allocation condition; if it meets the condition, according to the identity information of the target user and the instance occupancy information of the target user's custom code in operation, an instance is allocated from the container instance pool for the custom code to be run to run the custom code to be run. The above scheme, by introducing the container instance pool to run the target user's custom code to be run in the code running, realizes the isolation between the running thread of the code running platform and the running thread of the custom code, thereby improving the efficiency of running the custom code; further, by determining that the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user, the instance is allocated according to the identity information of the target user and the instance occupancy information, thereby improving the resource utilization rate of the instances in the container instance pool.

[0074] Optionally, in one embodiment, Figure 3 As shown, a method for determining whether a target user meets the allocation condition is provided, and the above S202 is refined, specifically including the following steps:

[0075] S301, determining the concurrent task amount of the target user at the current moment according to the concurrent task information.

[0076] Among them, the concurrent task volume is the number of tasks that the target user runs concurrently using the low-code platform at the current moment.

[0077] Optionally, the concurrent task volume of the target user at the current moment may be counted based on the concurrent task information.

[0078] S302: Determine a concurrent task threshold of the target user according to the identity information of the target user.

[0079] Among them, the concurrent task threshold is the total number of tasks that the target users are allowed to run in parallel on the low-code platform.

[0080] Optionally, the total number of tasks that are allowed to run in parallel on the low-code platform and are pre-set for the target user can be determined based on the target user's identity information as the target user's concurrent task threshold.

[0081] S303: If the concurrent task amount is less than the concurrent task threshold, it is determined that the target user meets the assignable condition.

[0082] In this embodiment, by introducing the concurrent task volume of the target user at the current moment and the concurrent task threshold of the target user, it is ensured that the target user's custom code to be run is allowed to run when the concurrent task volume is less than the concurrent task threshold, thereby achieving overload protection for the code running platform (such as a low-code platform).

[0083] Optionally, in one embodiment, Figure 4 As shown, a method for allocating an instance for a custom code to be run from a container instance pool is provided, and the above S203 is refined, specifically including the following steps:

[0084] S401, acquiring, according to the identity information of the target user, the instance occupancy information of the running custom code of the target user and the threshold value of the number of instances that can be occupied by the target user.

[0085] The threshold of the number of instances that can be occupied by the target user is the maximum number of instances that can be occupied by the target user in the container instance pool.

[0086] Optionally, in an embodiment of the present application, a key-value database (such as redis) is provided as a registration center to store instance information of each active instance in the container instance pool. Exemplarily, the instance information of each instance includes but is not limited to identification information of the custom code running by the instance, port information corresponding to the instance, and time of instance heartbeat reporting. Active instances in the container instance pool need to report instance information to the specified key-value database every 2 seconds by reporting heartbeats. When the heartbeat reporting time is greater than 2 seconds, the instance has no active information within the specified tolerable time, and the instance cannot be used to execute business code. Figure 5 As shown in FIG. 1 , it is a schematic diagram of users of different identity levels reporting heartbeats to the registration center (i.e., redis cache).

[0087] It should be noted that when users with different identity levels report the instance status of instances in the container instance pool, they need to write their own instance information into different service names. The main user low-code runtime obtains instances from instance pools corresponding to different service names according to different routing rules.

[0088] Optionally, when the target user's custom code to be run is to be executed in the low-code runtime, the target user's identity level can be determined based on the target user's identity information, and the instance occupancy information of the target user's running custom code and the threshold number of instances that the target user can occupy can be obtained from different redis service names based on the target user's identity level.

[0089] S402: Allocate an instance for the custom code to be run from a container instance pool according to the instance occupancy information, the instance number threshold, and the identity information.

[0090] Optionally, different treatments can be performed for users of different identity levels based on identity information. For example, for users with high identity levels, idle instances can be allocated to target users based on instance occupancy information and instance number thresholds; for users with low identity levels, occupied instances can be allocated to target users based on instance occupancy information and instance number thresholds. Instance occupancy information includes but is not limited to instance occupancy count.

[0091] Optionally, in order to ensure the efficiency of each user when running the custom code, different instance number thresholds are set for users of different levels. Furthermore, different instances can be allocated to the custom code to be run based on the relationship between the instance occupancy number and the instance number threshold.

[0092] Exemplarily, if the number of occupied instances is less than the instance number threshold, an idle instance in the container instance pool is allocated to the custom code to be run according to the identity information. Optionally, if the number of occupied instances is less than the instance number threshold, it means that there are still idle instances in the container instance pool that can run the code to be run. In this case, an idle instance in the corresponding container instance pool can be allocated to the custom code to be run according to the identity information.

[0093] Correspondingly, if the number of instance occupancy is greater than the instance number threshold, an occupied instance in the container instance pool is allocated to the custom code to be run based on the identity information. Optionally, if the number of instance occupancy is greater than the instance number threshold, it means that there are no idle instances in the container instance pool that can run the code to be run. At this time, it is necessary to allocate the occupied instance in the corresponding container instance pool to the custom code to be run based on the identity information. It can be understood that by reasonably allocating instances to the code to be run based on the size relationship between the number of instance occupancy and the instance number threshold, and combining the identity information, it is ensured that the code to be run can run stably.

[0094] In this embodiment, by introducing a threshold of the number of instances that can be occupied by the target user and comprehensively considering the instance occupancy information, the instance number threshold and the identity information, instances are allocated to the custom code to be run from the container instance pool, thereby ensuring the rationality and accuracy of the instances allocated to the target custom code to be run.

[0095] Optionally, in order to better serve users, different container instance pools can be set for users of different identity levels. Therefore, in an embodiment of the present application, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; that is, the first-level user corresponds to the first-level container instance pool, and the second-level user corresponds to the second-level container instance pool. In this case, according to the identity information, the method of allocating idle instances in the container instance pool for the custom code to be run can also be: if the identity information is a first-level user, any idle instance in the first-level container instance pool is allocated to the custom code to be run. If the identity information is a second-level user, any idle instance in the second-level container instance pool is allocated to the custom code to be run. It can be understood that by setting different container instance pools for users of different identity levels, corresponding services can be provided to different users in a targeted manner, ensuring the efficiency and accuracy of users of different identity levels running custom code.

[0096] It should be noted that after obtaining the instance during the low-code runtime, the following update operations need to be performed in a distributed lock: Update the instance call semaphore to control the number of concurrent instances. At the same time, the association between the instance and the user to whom the custom code belongs needs to be updated to obtain the instance occupancy information of the instance currently occupied by the user.

[0097] On this basis, according to the identity information, the method of allocating occupied instances in the container instance pool for the custom code to be run can also be: if the identity information is an ordinary user, then arbitrarily allocate an occupied instance from the first-level container instance pool for the custom code to be run; if the identity information is an important user, then arbitrarily allocate an occupied instance from the second-level container instance pool occupied by the target user's running custom code for the custom code to be run. In theory, each request should be assigned an idle instance for execution, but for malicious attacks or time-consuming tasks, all instances may be consumed, resulting in the inability to execute custom codes of other users. Therefore, for the first-level container instance pool, instances in the same first-level container instance pool at the same time can only execute the custom code of the same first-level user; and for the second-level container instance pool, all second-level users share a second-level container instance pool.

[0098] It should be noted that in order to ensure the stability and resource utilization of the container instance pool, the container instance pool can be manually or automatically expanded and reduced in real time according to the instance occupancy. Based on this, in order to avoid the business code execution taking too long due to instance startup, the container instance pool will start N instances by default. And in the dynamic expansion and contraction process, it is necessary to ensure that at least N instances are active. In the two types of container instance pools, the first-level container instance pool and the second-level container instance pool, the minimum number of active instances maintained can be configured according to actual conditions. In an embodiment of the present application, it supports dynamic expansion or reduction of the container instance pool in the following two ways.

[0099] The first method is dynamic expansion through scheduled tasks. A scheduled task is maintained in the low-code runtime. The scheduled task scans the idle / occupied status of instances in the container instance pool and dynamically expands or shrinks the container instance pool. The second method is event triggering. In the low-code runtime, when an instance in the container instance pool is called to execute the user's custom code, the engine operation and scheduling logs are collected asynchronously. When the instance occupancy rate in the container instance pool reaches 80% and there is still a continuous call volume, an expansion event is triggered. By responding to the expansion event, the number of active instances in the container instance pool is dynamically increased to improve the custom code call response.

[0100] It should be noted that in order to ensure that the execution waiting and queuing of custom codes between different users do not affect each other and reduce the risk of user malicious code affecting the execution delay of other user custom codes, in the embodiment of the present application, a local thread pool is used to implement the task waiting isolation solution between different users. Figure 6As shown, a schematic diagram of the local thread pool task queue provided by an embodiment of the present application is provided. When the execution instance cannot be obtained due to insufficient instances in the instance pool, the task needs to be queued for a short time, and the task queuing of the first-level user 1 does not affect the task waiting queue of the first-level user 2 thread pool. For this purpose, it is necessary to provide a local thread pool for each user for task queuing, and allow the setting of the waiting timeout. When executing the user's custom code, the task is first submitted to the local thread pool corresponding to the user, and then the executable instance is obtained from the container instance pool in each thread. When the instance cannot be obtained, it is queued and retried in the thread pool.

[0101] Optionally, in order to more intuitively implement the code running method provided in the embodiment of the present application, in the embodiment of the present application, the low-code platform is used as the application scenario, and the groovy execution engine used to run custom code in the low-code platform is placed in the container instance pool for operation. Figure 7 As shown, it is an architecture diagram of a low-code platform that introduces the container instance pool provided in an embodiment of the present application. Among them, a key-value memory is used in the registration center to cache the instance information of each instance in the container instance pool; when the target user runs the custom code to be run, the low-code platform starts the low-code runtime service, and after judging that the custom code to be run meets the instance allocatable conditions, it calls the instance in the first-level container instance pool or the second-level container pool through custom load balancing, overload protection, instance call current limiting and monitoring and early warning and other technologies; further, the data of the registration center is updated according to the instance call situation. The storage area is used to store various data generated by the operation of the low-code platform. Among them, the custom load balancing realizes the process of allocating occupied instances in the container instance pool for the custom code to be run according to the identity information; overload protection and instance call current limiting ensure that the number of instance occupancy of the target user does not exceed the instance number threshold.

[0102] Figure 8 FIG. 1 is a flow chart of a code running method in another embodiment. Based on the above embodiment, this embodiment provides an optional example of a code running method. Figure 8 The specific implementation process is as follows:

[0103] S801, when receiving a running instruction for a custom code to be run sent by a target user, obtaining concurrent task information of the target user at the current moment according to the identity information of the target user.

[0104] S802: Determine the concurrent task amount of the target user at the current moment according to the concurrent task information.

[0105] S803: Determine a concurrent task threshold of the target user according to the identity information of the target user.

[0106] S804, determine whether the concurrent task amount is less than the concurrent task threshold; if so, execute S805; if not, execute S813.

[0107] S805 , obtaining the number of instances of the running custom code of the target user and the threshold of the number of instances that can be occupied by the target user according to the identity information of the target user.

[0108] S806, determine whether the instance occupancy number is less than the instance number threshold; if so, execute S807; if not, execute S810.

[0109] S807, determine whether the identity information is a first-level user; if so, execute S808; if not, execute S809.

[0110] S808: Allocate any idle instance in the first-level container instance pool to the custom code to be executed.

[0111] S809: Allocate any idle instance in the second-level container instance pool to the custom code to be run.

[0112] S810, determine whether the identity information is a first-level user; then execute S811; if not, execute S812.

[0113] S811: Allocate an occupied instance from the first-level container instance pool to the custom code to be run.

[0114] S812: Allocate any occupied instance from the occupied instances in the second-level container instance pool that are occupied by the running custom code of the target user to the custom code to be run.

[0115] S813: Do not respond to the operation instruction and generate operation abnormality information.

[0116] The specific process of the above S801-S813 can be found in the description of the above method embodiment. The implementation principle and technical effect are similar and will not be repeated here.

[0117] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0118] Based on the same inventive concept, the embodiment of the present application also provides a code running device for implementing the code running method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more code running device embodiments provided below can refer to the limitations on the code running method above, and will not be repeated here.

[0119] In an exemplary embodiment, Fig. 9 As shown, a code running device 900 is provided, including: an information acquisition module 910, a condition determination module 920 and a code running module 930, wherein:

[0120] The information acquisition module 910 is used to acquire concurrent task information of the target user at the current moment according to the identity information of the target user when receiving the running instruction for the custom code to be run sent by the target user;

[0121] The condition determination module 920 is used to determine whether the custom code to be executed meets the instance allocatable condition according to the concurrent task information and the identity information of the target user;

[0122] The code running module 930 is used to allocate an instance to the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code being run by the target user, so as to run the custom code to be run.

[0123] The above-mentioned code running device, when receiving the running instruction for the custom code to be run sent by the target user, obtains the concurrent task information of the target user at the current moment according to the identity information of the target user; determines whether the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user; if it meets the condition, allocates an instance for the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run. The above-mentioned scheme, by introducing the container instance pool to run the custom code to be run by the target user in the code operation, realizes the isolation between the running thread of the code operation platform and the running thread of the custom code, thereby improving the efficiency of running the custom code; further, by determining that the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user, the instance is allocated according to the identity information of the target user and the instance occupancy information, thereby improving the resource utilization rate of the instances in the container instance pool.

[0124] In one embodiment, the condition determination module 920 is specifically used to:

[0125] According to the concurrent task information, the concurrent task amount of the target user at the current moment is determined; according to the identity information of the target user, the concurrent task threshold of the target user is determined; if the concurrent task amount is less than the concurrent task threshold, it is determined that the target user meets the assignable condition.

[0126] In one embodiment, the code execution module 930 includes:

[0127] The threshold determination unit is used to obtain the instance occupancy information of the running custom code of the target user and the threshold of the number of instances that the target user can occupy according to the identity information of the target user.

[0128] The code running unit is used to allocate instances for the custom code to be run from the container instance pool according to the instance occupancy information, instance number threshold and identity information.

[0129] In one embodiment, the instance occupancy information includes the instance occupancy number; the code execution unit includes:

[0130] The first subunit is configured to allocate an idle instance in a container instance pool to the custom code to be run according to the identity information if the number of occupied instances is less than an instance number threshold.

[0131] The second subunit is used to allocate an occupied instance in the container instance pool to the custom code to be run according to the identity information if the number of occupied instances is greater than the instance number threshold.

[0132] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; and the first subunit is specifically used for:

[0133] If the identity information is a first-level user, any idle instance in the first-level container instance pool is allocated to the custom code to be run; if the identity information is a second-level user, any idle instance in the second-level container instance pool is allocated to the custom code to be run.

[0134] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; the second subunit is specifically used for:

[0135] If the identity information is that of an ordinary user, an occupied instance is arbitrarily allocated from the first-level container instance pool for the custom code to be run; if the identity information is that of an important user, an occupied instance is arbitrarily allocated from the occupied instances occupied by the running custom code of the target user in the second-level container instance pool for the custom code to be run.

[0136] Each module in the above code running device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0137] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a code running method is implemented.

[0138] Those skilled in the art will understand that Fig.10The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0139] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0140] When receiving a running instruction for the custom code to be run sent by the target user, obtaining the concurrent task information of the target user at the current moment according to the identity information of the target user;

[0141] Determine whether the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user;

[0142] If the conditions are met, an instance is allocated to the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code being run by the target user, so as to run the custom code to be run.

[0143] In one embodiment, when the processor executes the computer program to determine whether the target user meets the assignable condition based on the concurrent task information and the identity information of the target user, the processor further implements the following steps:

[0144] According to the concurrent task information, the concurrent task amount of the target user at the current moment is determined; according to the identity information of the target user, the concurrent task threshold of the target user is determined; if the concurrent task amount is less than the concurrent task threshold, it is determined that the target user meets the assignable condition.

[0145] In one embodiment, when the processor executes the computer program to allocate an instance for the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, the following steps are also implemented:

[0146] According to the identity information of the target user, the instance occupancy information of the target user's custom code in operation and the threshold of the number of instances that the target user can occupy are obtained; according to the instance occupancy information, the threshold of the number of instances and the identity information, an instance is allocated from the container instance pool for the custom code to be run.

[0147] In one embodiment, the instance occupancy information includes the instance occupancy number; when the processor executes the computer program to allocate an instance for the custom code to be run from the container instance pool according to the instance occupancy information, the instance number threshold and the identity information, the following steps are also implemented:

[0148] If the number of occupied instances is less than the instance number threshold, an idle instance in the container instance pool is allocated to the custom code to be run based on the identity information; if the number of occupied instances is greater than the instance number threshold, an occupied instance in the container instance pool is allocated to the custom code to be run based on the identity information.

[0149] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; when the processor executes the computer program to allocate an idle instance in the container instance pool for the custom code to be run, the following steps are also implemented:

[0150] If the identity information is a first-level user, any idle instance in the first-level container instance pool is allocated to the custom code to be run; if the identity information is a second-level user, any idle instance in the second-level container instance pool is allocated to the custom code to be run.

[0151] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; when the processor executes the computer program to allocate an occupied instance in the container instance pool for the custom code to be run according to the identity information, the following steps are also implemented:

[0152] If the identity information is that of an ordinary user, an occupied instance is arbitrarily allocated from the first-level container instance pool for the custom code to be run; if the identity information is that of an important user, an occupied instance is arbitrarily allocated from the occupied instances occupied by the running custom code of the target user in the second-level container instance pool for the custom code to be run.

[0153] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0154] When receiving a running instruction for the custom code to be run sent by the target user, obtaining the concurrent task information of the target user at the current moment according to the identity information of the target user;

[0155] Determine whether the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user;

[0156] If the conditions are met, an instance is allocated to the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code being run by the target user, so as to run the custom code to be run.

[0157] In one embodiment, when the processor executes the computer program to determine whether the target user meets the assignable condition based on the concurrent task information and the identity information of the target user, the processor further implements the following steps:

[0158] According to the concurrent task information, the concurrent task amount of the target user at the current moment is determined; according to the identity information of the target user, the concurrent task threshold of the target user is determined; if the concurrent task amount is less than the concurrent task threshold, it is determined that the target user meets the assignable condition.

[0159] In one embodiment, when the processor executes the computer program to allocate an instance for the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, the following steps are also implemented:

[0160] According to the identity information of the target user, the instance occupancy information of the target user's custom code in operation and the threshold of the number of instances that the target user can occupy are obtained; according to the instance occupancy information, the threshold of the number of instances and the identity information, an instance is allocated from the container instance pool for the custom code to be run.

[0161] In one embodiment, the instance occupancy information includes the instance occupancy number; when the processor executes the computer program to allocate an instance for the custom code to be run from the container instance pool according to the instance occupancy information, the instance number threshold and the identity information, the following steps are also implemented:

[0162] If the number of occupied instances is less than the instance number threshold, an idle instance in the container instance pool is allocated to the custom code to be run based on the identity information; if the number of occupied instances is greater than the instance number threshold, an occupied instance in the container instance pool is allocated to the custom code to be run based on the identity information.

[0163] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; when the processor executes the computer program to allocate an idle instance in the container instance pool for the custom code to be run, the following steps are also implemented:

[0164] If the identity information is a first-level user, any idle instance in the first-level container instance pool is allocated to the custom code to be run; if the identity information is a second-level user, any idle instance in the second-level container instance pool is allocated to the custom code to be run.

[0165] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; when the processor executes the computer program to allocate an occupied instance in the container instance pool for the custom code to be run according to the identity information, the following steps are also implemented:

[0166] If the identity information is that of an ordinary user, an occupied instance is arbitrarily allocated from the first-level container instance pool for the custom code to be run; if the identity information is that of an important user, an occupied instance is arbitrarily allocated from the occupied instances occupied by the running custom code of the target user in the second-level container instance pool for the custom code to be run.

[0167] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0168] When receiving a running instruction for the custom code to be run sent by the target user, obtaining the concurrent task information of the target user at the current moment according to the identity information of the target user;

[0169] Determine whether the custom code to be run meets the instance allocation condition according to the concurrent task information and the identity information of the target user;

[0170] If the conditions are met, an instance is allocated to the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code being run by the target user, so as to run the custom code to be run.

[0171] In one embodiment, when the processor executes the computer program to determine whether the target user meets the assignable condition based on the concurrent task information and the identity information of the target user, the processor further implements the following steps:

[0172] According to the concurrent task information, the concurrent task amount of the target user at the current moment is determined; according to the identity information of the target user, the concurrent task threshold of the target user is determined; if the concurrent task amount is less than the concurrent task threshold, it is determined that the target user meets the assignable condition.

[0173] In one embodiment, when the processor executes the computer program to allocate an instance for the custom code to be run from the container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, the following steps are also implemented:

[0174] According to the identity information of the target user, the instance occupancy information of the target user's custom code in operation and the threshold of the number of instances that the target user can occupy are obtained; according to the instance occupancy information, the threshold of the number of instances and the identity information, an instance is allocated from the container instance pool for the custom code to be run.

[0175] In one embodiment, the instance occupancy information includes the instance occupancy number; when the processor executes the computer program to allocate an instance for the custom code to be run from the container instance pool according to the instance occupancy information, the instance number threshold and the identity information, the following steps are also implemented:

[0176] If the number of occupied instances is less than the instance number threshold, an idle instance in the container instance pool is allocated to the custom code to be run based on the identity information; if the number of occupied instances is greater than the instance number threshold, an occupied instance in the container instance pool is allocated to the custom code to be run based on the identity information.

[0177] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; when the processor executes the computer program to allocate an idle instance in the container instance pool for the custom code to be run, the following steps are also implemented:

[0178] If the identity information is a first-level user, any idle instance in the first-level container instance pool is allocated to the custom code to be run; if the identity information is a second-level user, any idle instance in the second-level container instance pool is allocated to the custom code to be run.

[0179] In one embodiment, the identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; when the processor executes the computer program to allocate an occupied instance in the container instance pool for the custom code to be run according to the identity information, the following steps are also implemented:

[0180] If the identity information is that of an ordinary user, an occupied instance is arbitrarily allocated from the first-level container instance pool for the custom code to be run; if the identity information is that of an important user, an occupied instance is arbitrarily allocated from the occupied instances occupied by the running custom code of the target user in the second-level container instance pool for the custom code to be run.

[0181] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0182] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0183] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0184] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A code running method, characterized in that: The method comprises: When receiving a running instruction for the custom code to be run sent by the target user, obtaining concurrent task information of the target user at the current moment according to the identity information of the target user; Determining whether the to-be-run custom code meets an instance allocatable condition according to the concurrent task information and the identity information of the target user; If so, an instance is allocated to the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run.

2. The method according to claim 1, characterized in that The determining, according to the concurrent task information and the identity information of the target user, whether the target user meets the assignable condition includes: Determine the concurrent task amount of the target user at the current moment according to the concurrent task information; Determining a concurrent task threshold of the target user according to the identity information of the target user; If the concurrent task amount is less than the concurrent task threshold, it is determined that the target user meets the assignable condition.

3. The method according to claim 1, characterized in that The allocating an instance for the to-be-run custom code from a container instance pool according to the identity information of the target user and the instance occupancy information of the running custom code of the target user includes: According to the identity information of the target user, acquiring instance occupancy information of the running custom code of the target user and a threshold value of the number of instances that can be occupied by the target user; According to the instance occupancy information, the instance number threshold, and the identity information, an instance is allocated to the to-be-run custom code from a container instance pool.

4. The method according to claim 3, characterized in that The instance occupancy information includes the instance occupancy number; The allocating an instance for the to-be-run custom code from a container instance pool according to the instance occupancy information, the instance number threshold, and the identity information includes: If the instance occupancy number is less than the instance number threshold, allocating an idle instance in a container instance pool to the custom code to be run according to the identity information; If the number of occupied instances is greater than the instance number threshold, an occupied instance in the container instance pool is allocated to the custom code to be run according to the identity information.

5. The method according to claim 4, characterized in that The identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; The allocating, according to the identity information, an idle instance in a container instance pool for the custom code to be run includes: If the identity information is a first-level user, allocating any idle instance in the first-level container instance pool to the custom code to be run; If the identity information is of a second-level user, any idle instance in the second-level container instance pool is allocated to the custom code to be run.

6. The method according to claim 4, characterized in that The identity information is a first-level user or a second-level user; the container instance pool includes a first-level container instance pool and a second-level container instance pool; wherein the first level is higher than the second level; The allocating an occupied instance in the container instance pool to the custom code to be run according to the identity information includes: If the identity information is that of a common user, an occupied instance is randomly allocated to the custom code to be run from the first-level container instance pool; If the identity information is an important user, then an occupied instance is randomly allocated to the custom code to be run from the occupied instances occupied by the running custom code of the target user in the second-level container instance pool.

7. A code running device, characterized in that: The device comprises: An information acquisition module, configured to, upon receiving a running instruction for a custom code to be run sent by a target user, acquire concurrent task information of the target user at the current moment according to the identity information of the target user; A condition determination module, used to determine whether the custom code to be run meets the instance allocatable condition according to the concurrent task information and the identity information of the target user; The code running module is used to allocate an instance to the custom code to be run from a container instance pool according to the identity information of the target user and the instance occupancy information of the custom code of the target user in operation, so as to run the custom code to be run, if the conditions are met.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.