Code execution method and device, storage medium and electronic equipment

By creating a cloud development environment when receiving the login instruction of the target user, creating an objective function instance based on the cloud development environment, and creating an HTTP trigger based on the objective function instance, the problem of traditional code execution environment relying on hardware resources is solved, and efficient and flexible code execution and management is achieved.

CN119691713APending Publication Date: 2025-03-25INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The traditional code execution environment relies on the hardware resources of the local computer and requires repeated complex environment construction and maintenance, resulting in reduced code execution efficiency.

Method used

By creating a cloud development environment when receiving the login instruction of the target user, creating an objective function instance based on the cloud development environment, and creating an HTTP trigger based on the objective function instance, the code execution and management is realized.

Benefits of technology

It improves code execution efficiency, simplifies the construction and maintenance of the development environment, enhances development flexibility and user experience, and reduces resource costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691713A_ABST
    Figure CN119691713A_ABST
Patent Text Reader

Abstract

The invention discloses a code execution method and device, a storage medium and electronic equipment, and relates to the field of cloud computation.The method comprises the steps that under the condition that a login instruction of a target user is received, a cloud development environment is created; creating a target function instance according to the cloud development environment; creating an HTTP trigger based on the objective function instance; and accessing the cloud development environment through the HTTP trigger in the browser, and executing the to-be-executed code of the target user through the target function instance. By means of the method and device, the problem that in the related technology, a traditional code execution environment depends on hardware resources of a local computer, complex environment building and maintenance need to be conducted repeatedly, and consequently the code execution efficiency is reduced is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing, and more specifically, to a code execution method, device, storage medium, and electronic device. Background Art

[0002] Traditional IDEs need to be installed and configured on local computers, which means developers need to spend a lot of time setting up and maintaining the environment. At the same time, traditional IDEs rely on the hardware computing resources of local computers, consume a lot of resources, and can only be opened and used on users' local computers. It is difficult to switch and synchronize the environment between different devices, and they are insufficient in terms of flexibility of use and resource efficiency.

[0003] With the development of cloud computing technology, more and more developers are starting to use Cloud IDE for development. Cloud IDE deploys the development environment in the cloud, and developers can access the development environment through a browser without installing local software. However, existing Cloud IDEs still have problems such as performance bottlenecks and low resource utilization.

[0004] Currently, no effective solution has been proposed to the problem that the traditional code execution environment in related technologies relies on the hardware resources of the local computer and requires repeated complex environment construction and maintenance, resulting in reduced code execution efficiency. Summary of the invention

[0005] The main purpose of the present application is to provide a code execution method, device, storage medium and electronic device to solve the problem in the related art that the traditional code execution environment depends on the hardware resources of the local computer, requires repeated complex environment construction and maintenance, and leads to reduced code execution efficiency.

[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a code execution method is provided, which includes: upon receiving a login instruction of a target user, creating a cloud development environment, wherein the login instruction represents an instruction for the target user to log in to a function computing platform; creating a target function instance based on the cloud development environment, wherein the target function instance represents a function instance for executing the target user's code to be executed; creating an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; accessing the cloud development environment through the HTTP trigger in a browser, and executing the target user's code to be executed through the target function instance.

[0007] Furthermore, upon receiving a login instruction from a target user, a cloud development environment is created, including: extracting user information of the target user in the login instruction, and verifying the user information to obtain a verification result; when the verification result indicates that the verification is passed, determining configuration information of the target user, wherein the configuration information includes at least: configuration information of the cloud development environment, storage configuration information; creating a distributed storage space based on the storage configuration information; and creating the cloud development environment based on the distributed storage space and the configuration information of the cloud development environment.

[0008] Furthermore, the configuration information of the target user is determined, and a distributed storage space is created based on the storage configuration information, including: receiving development task information of the target user, and determining a data processing scope involved in the development task information; determining the storage configuration information based on the data processing scope; creating the distributed storage space based on the storage configuration information, and configuring access rights to the distributed storage space and access credentials to the distributed storage space.

[0009] Furthermore, creating a target function instance based on the cloud development environment includes: receiving code information uploaded by the target user; creating the target function instance through the cloud development environment based on the code information; and mounting the distributed storage space to the target function instance based on the access credentials.

[0010] Furthermore, after accessing the cloud development environment through the HTTP trigger in the browser, the method also includes: determining whether there is a target function instance in a running state in the cloud development environment, and obtaining a determination result; if the determination result indicates that the target function instance is not in a running state, creating the target function instance, and executing the target user's code to be executed through the target function instance; if the determination result indicates that the target function instance is in a running state, executing the target user's code to be executed through the target function instance.

[0011] Furthermore, after executing the target user's to-be-executed code through the target function instance, the method also includes: determining a first moment when the target user sends a first request, wherein the first request represents a request for execution of code sent by the target user to the cloud development environment; determining a second moment when the target user sends a second request, wherein the second request represents the next request for execution of code sent by the target user to the cloud development environment after the first moment; and releasing the resources occupied by the target function instance when the interval between the second moment and the first moment is greater than a preset duration.

[0012] Furthermore, after creating an HTTP trigger based on the target function instance, the method also includes: determining N function instances in the cloud development environment, wherein the N function instances represent function instances in running state in the cloud development environment, and N is an integer greater than or equal to 0; determining resource occupancy information of each function instance in the N function instances; and adjusting the resource information occupied by each function instance in the N function instances according to a preset load balancing algorithm and the resource occupancy information of each function instance.

[0013] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a code execution device is provided, which includes: a first creation unit, which is used to create a cloud development environment when receiving a login instruction of a target user, wherein the login instruction represents an instruction for the target user to log in to a function computing platform; a second creation unit, which is used to create a target function instance based on the cloud development environment, wherein the target function instance represents a function instance used to execute the target user's code to be executed; a third creation unit, which is used to create an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; a first execution unit, which is used to access the cloud development environment through the HTTP trigger in a browser, and execute the target user's code to be executed through the target function instance.

[0014] Furthermore, the first creation unit includes: a verification subunit, used to extract user information of the target user in the login instruction, and verify the user information to obtain a verification result; a determination subunit, used to determine the configuration information of the target user when the verification result indicates that the verification is passed, wherein the configuration information includes at least: configuration information of the cloud development environment and storage configuration information; a first creation subunit, used to create a distributed storage space based on the storage configuration information; and a second creation subunit, used to create the cloud development environment based on the distributed storage space and the configuration information of the cloud development environment.

[0015] Furthermore, the determination subunit includes: a receiving module, used to receive the development task information of the target user and determine the data processing scope involved in the development task information; a determination module, used to determine the storage configuration information based on the data processing scope; the first creation subunit includes: a module, used to create the distributed storage space based on the storage configuration information, and configure the access rights of the distributed storage space and the access credentials of the distributed storage space.

[0016] Furthermore, the second creation unit includes: a receiving subunit, used to receive code information uploaded by the target user; a third creation subunit, used to create the target function instance through the cloud development environment based on the code information; and a mounting subunit, used to mount the distributed storage space to the target function instance based on the access credentials.

[0017] Furthermore, the device also includes: a judgment unit, which is used to judge whether there is a target function instance in a running state in the cloud development environment after accessing the cloud development environment through the HTTP trigger in the browser, and obtain a judgment result; a fourth creation unit, which is used to create the target function instance when the judgment result indicates that the target function instance is not in a running state, and execute the target user's code to be executed through the target function instance; a second execution unit, which is used to execute the target user's code to be executed through the target function instance when the judgment result indicates that the target function instance is in a running state.

[0018] Furthermore, the device also includes: a first determination unit, used to determine a first moment when the target user sends a first request after executing the target user's to-be-executed code through the target function instance, wherein the first request represents a request for execution of the code sent by the target user to the cloud development environment; a second determination unit, used to determine a second moment when the target user sends a second request, wherein the second request represents the next request for execution of the code sent by the target user to the cloud development environment after the first moment; and a release unit, used to release the resources occupied by the target function instance when the interval between the second moment and the first moment is greater than a preset duration.

[0019] Furthermore, the device also includes: a third determination unit, used to determine N function instances in the cloud development environment after creating an HTTP trigger based on the target function instance, wherein the N function instances represent function instances in a running state in the cloud development environment, and N is an integer greater than or equal to 0; a fourth determination unit, used to determine resource occupancy information of each function instance in the N function instances; and an adjustment unit, used to adjust the resource information occupied by each function instance in the N function instances according to a preset load balancing algorithm and the resource occupancy information of each function instance.

[0020] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements any one of the above-mentioned code execution methods, and which, when executed by a processor, implements the steps of the code execution method described in each embodiment of the present application.

[0021] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes stored computer instructions, wherein when the computer instructions are executed by a processor, any one of the above-mentioned code execution methods is implemented.

[0022] In order to achieve the above-mentioned purpose, according to one aspect of the present application, an electronic device is provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement any one of the above-mentioned code execution methods.

[0023] In an embodiment of the present application, a cloud development environment is created upon receiving a login instruction from a target user, wherein the login instruction represents an instruction for the target user to log into a function computing platform; a target function instance is created based on the cloud development environment, wherein the target function instance represents a function instance for executing the target user's code to be executed; an HTTP trigger is created based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; the cloud development environment is accessed through the HTTP trigger in a browser, and the target user's code to be executed is executed through the target function instance, thereby achieving the purpose of executing code through the cloud development environment, thereby realizing the technical effect of improving the efficiency of code execution, and further solving the technical problem that the traditional code execution environment depends on the hardware resources of the local computer, requires repeated complex environment construction and maintenance, and leads to reduced code execution efficiency.

[0024] By receiving the login instructions sent by the target user and creating a cloud development environment and target function instance, users can start development work immediately without managing the underlying server, waiting for environment configuration or resource preheating, so that users can focus on writing code and developing logic, improving development efficiency and user experience. At the same time, by creating HTTP triggers for each target function instance, users can directly access their cloud development environment in the browser of any device without installing specific software or clients, eliminating the tedious steps of compilation, packaging, deployment, etc. commonly seen in traditional development environments, making the code testing and debugging process smoother and more efficient, greatly improving the flexibility of IDE use, and thus achieving the effect of improving code processing efficiency. In addition, each user has an independent target function instance and HTTP trigger, which provides natural isolation and security protection to prevent the code or resources of different users from affecting each other. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0026] Figure 1 It is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a code execution method provided in accordance with Embodiment 1 of the present application;

[0027] Figure 2 is a flowchart of an optional code execution method provided according to Embodiment 1 of the present application;

[0028] Figure 3 is a flow chart of a user accessing a function computing platform provided in Embodiment 1 of the present application;

[0029] Figure 4 is a flowchart of a user executing code through a function computing platform according to Embodiment 1 of the present application;

[0030] Figure 5 is a schematic diagram of the relationship between users and function instances provided according to the first embodiment of the present application;

[0031] Figure 6 is a schematic diagram of a code execution device provided according to Embodiment 2 of the present application;

[0032] Figure 7 It is a schematic diagram of a code execution electronic device provided according to Embodiment 5 of the present application. DETAILED DESCRIPTION

[0033] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0034] It should be noted that the methods and devices determined by the processing methods, devices, storage media and electronic devices of the present application documents can be used in the financial technology field to improve the efficiency of code execution during the process of developers executing code, and can also be used in any field except the financial technology field. The application fields of the methods and devices of the processing methods, devices, storage media and electronic devices of the present application documents are not limited.

[0035] It should be noted that the collected information (including but not limited to user device information, user personal information, collected data, used data, generated data, processed data, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, collected information, used information, generated information, processed information, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of relevant countries and regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or institutions to provide users with corresponding operation entrances for users to choose to agree or refuse the results of automated decision-making; if the user chooses to refuse, the expert decision-making process will be entered.

[0036] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0037] Function Compute: It is a fully managed serverless computing service driven by events. With Function Compute, users do not need to manage infrastructure such as servers, but only need to write business code snippets. The Function Compute platform will prepare computing resources for users, run user codes in an elastic and reliable manner, and provide functions such as log query, performance monitoring, and alarm.

[0038] Function instance: A function container process that runs a function code program.

[0039] Cloud IDE: A cloud-based integrated development environment.

[0040] Serverless: Serverless is a cloud computing model in which developers only need to provide code without having to manage server infrastructure. In the Serverless model, cloud service providers are responsible for infrastructure management tasks such as server clusters, automatic expansion, and automatic recovery required to run and manage the code. Developers only need to write and deploy code without having to worry about server management and operation.

[0041] Example 1

[0042] According to an embodiment of the present application, a method embodiment of code execution is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0043] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a code execution method. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (102a, 102 code execution, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (US code execution) port (which may be included as one of the ports of the code execution US bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0044] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As involved in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0045] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the code execution method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the above-mentioned code execution method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0046] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0047] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0048] Under the above operating environment, this application provides Figure 2 The code shown executes the method. Figure 2 It is a flowchart of the code execution method according to Example 1 of the present application.

[0049] The execution subject of the code execution method provided in Example 1 of the present application may be a function computing platform, which is responsible for the creation, operation, resource allocation and management of function instances. The function computing platform receives a request from an HTTP trigger, starts or wakes up the corresponding function instance according to the request, and ensures that the function instance can access the distributed storage space specified by the user and execute the code submitted by the user.

[0050] Step S101, upon receiving a login instruction from a target user, creating a cloud development environment, wherein the login instruction represents an instruction for the target user to log in to a function computing platform.

[0051] In the first embodiment, when a user uses the Cloud IDE based on Function Compute (i.e., the above-mentioned cloud development environment), he or she first needs to verify his or her identity and permissions through a login instruction, and then start the process of creating or accessing the cloud development environment. The target user refers to a developer (or other staff member) who intends to execute code through the cloud development environment.

[0052] Specifically, the target user enters a login instruction through the Cloud IDE portal or other login interface. This instruction contains the target user's identity information (such as user name and password) and access request. The login instruction is usually sent to the back-end system of the function computing platform through a web form submission or an API call. Once the target user's identity is verified, one or more function instances are created on the function computing platform based on the user configuration (such as IDE type, code storage space size), and each instance will serve as the target user's personal development environment. In an optional embodiment, if the target user already has a stored development environment, the development environment will be directly woken up or accessed without re-creating it.

[0053] Through the above steps, users do not need to wait for the environment to be set up and resources to be preheated. They can quickly access and use their cloud development environment through login instructions, which improves the work efficiency of developers.

[0054] Step S102 : creating a target function instance according to the cloud development environment, wherein the target function instance represents a function instance for executing the code to be executed by the target user.

[0055] In the first embodiment of the present invention, after the target user successfully logs in and requests access to the cloud development environment, one or more dedicated function instances are created on the function computing platform according to the configuration and needs of the target user. These instances will serve as the operating environment for the target user to execute code and perform development work.

[0056] Through these steps, the target function instance is created and configured as an independent running environment suitable for the target user to develop and execute code. This environment is dynamic and is only activated when the user needs to access the cloud development environment, helping users save resource costs while providing a flexible and efficient working experience.

[0057] Step S103: Create an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol.

[0058] In this first embodiment, in order to enable the target user to access its cloud development environment based on function computing through the Web, it is necessary to create an HTTP trigger for the target function instance. The creation process of this trigger includes setting the access rules of the function instance, such as the allowed HTTP methods, request paths, etc., and defining the trigger URL, that is, the entry point for users to access the IDE environment.

[0059] HTTP trigger is a component in the Function Compute service. As an interface, it allows external parties to call and control the execution of function instances through HTTP requests, so that function instances on the Function Compute platform can respond to HTTP requests from the Web (such as GET, POST, etc.). Through HTTP triggers, target users can interact with function instances through standard Web protocols without having to worry about the underlying computing resources and network configuration.

[0060] By creating HTTP triggers for each target function instance, users can easily access and control their cloud development environment through a web browser without installing local software or managing servers. This approach not only improves development efficiency, but also reduces the complexity of environment configuration and maintenance, making the cloud development environment more flexible, efficient and easy to use.

[0061] Step S104, access the cloud development environment through the HTTP trigger in the browser, and execute the target user's code to be executed through the target function instance.

[0062] In the first embodiment, the target user interacts with his / her own cloud development environment through a web browser to perform the process of code development, testing and running.

[0063] Specifically, through the browser, the user sends an HTTP request to the HTTP trigger. The request can be various development-related behaviors such as obtaining the IDE interface, uploading code, executing code, saving files, etc. The request usually contains the target user's code to be executed or operation instructions, as well as necessary parameters and data. After receiving the target user's request, the HTTP trigger will parse the data in the request to determine the specific operation or code instruction to be executed. The HTTP trigger forwards the request and data to the corresponding target function instance, that is, the function container exclusive to the target user, for processing the request. After receiving the request forwarded by the HTTP trigger, the target function instance will execute the corresponding logic according to the request content. If the request contains code to be executed, the IDE program in the function instance will load and parse the code and perform development operations such as compiling and running. At the same time, the function instance will also process other IDE function requests from users, such as editing, debugging, version control, etc.

[0064] In this way, target users do not need to install and configure the development environment on their local computers, but can directly access and control their cloud development environment based on Function Compute through a web browser to perform code development tasks. This method improves development flexibility and efficiency, reduces resource costs, and ensures the consistency and security of the development environment.

[0065] Optionally, in the code execution method provided in Example 1 of the present application, when a login instruction of a target user is received, a cloud development environment is created, including: extracting user information of the target user in the login instruction, and verifying the user information to obtain a verification result; when the verification result indicates that the verification is passed, determining configuration information of the target user, wherein the configuration information includes at least: configuration information of the cloud development environment, storage configuration information; creating a distributed storage space based on the storage configuration information; and creating a cloud development environment based on the distributed storage space and the configuration information of the cloud development environment.

[0066] In the first embodiment of the present invention, when the target user attempts to access the cloud development environment through a login instruction (such as clicking a login button or sending a login API request), the function computing platform extracts the target user's user information from the login instruction, including the target user's identifier (such as user name, email address or mobile phone number) and verification credentials (such as password or token). The extracted user information of the target user is compared with the user name and password in the pre-stored user database to verify the legitimacy of the user identity. The verification process may include security measures such as password encryption comparison, two-factor authentication or multi-factor authentication to ensure that only authorized users can access their cloud development environment. If the verification is successful, the subsequent steps will be executed; if the verification fails, an error message will be returned to prompt the target user to re-enter or take other verification methods.

[0067] After the user information is successfully verified, the configuration information entered by the target user is received, or the configuration information pre-stored by the target user is read. The configuration information usually contains the user's specific requirements for the cloud development environment, such as: Cloud development environment configuration information: including the type of cloud development environment, required memory size, CPU resources, network configuration, etc.; Storage configuration information: including the type of user code and project file storage (such as distributed file system, object storage, etc.), storage space size, etc.

[0068] Then, based on the storage configuration information, a dedicated storage space is allocated and created for the target user on the distributed storage service of the function computing platform. This space is used to persist the target user's code, project files, and other development resources, ensuring that the target user can access the same development environment at different times or on different devices. Based on the target user's cloud development environment configuration information and the created distributed storage space, a cloud development environment exclusive to the target user is created or awakened on the function computing platform.

[0069] Through the above steps, target users can safely and efficiently access their personalized cloud development environment to perform a series of development activities such as code editing, compiling, and running without having to worry about the underlying computing resources and storage management, which greatly simplifies the development process and improves development efficiency.

[0070] Optionally, in the code execution method provided in Example 1 of the present application, the configuration information of the target user is determined, and a distributed storage space is created based on the storage configuration information, including: receiving development task information of the target user, and determining the data processing scope involved in the development task information; determining the storage configuration information based on the data processing scope; creating a distributed storage space based on the storage configuration information, and configuring access rights and access credentials of the distributed storage space.

[0071] In the first embodiment, when the target user submits or starts a development task through the cloud development platform, it is necessary to first receive the development task related information submitted by the target user. This may include project type, estimated code volume, expected data processing scale, data access mode (such as frequent reading and writing, large file storage, etc.), etc.

[0072] Then, analyze the development task information submitted by the user and evaluate the data processing scope involved. The data processing scope refers to the scale and type of data that needs to be stored, read, written, or processed during task execution. This helps to understand the user's possible storage needs, such as how much storage space is needed, whether a specific data access speed or type (such as storage with high I / O performance) is required. Based on the determined data processing scope, further refine the storage configuration information. This may include selecting a suitable distributed storage type (such as object storage, block storage, or file system), defining the size of the storage space, and setting the performance parameters of storage resources (such as IOPS, throughput). Storage configuration information is directly related to the storage efficiency and cost of user development tasks.

[0073] Secondly, based on the storage configuration information, a dedicated storage space is created for the target user in the distributed storage service of the Function Compute platform. This storage space will provide persistent data storage for the user's development tasks, ensuring the security and consistency of code, project files, and other development resources.

[0074] In addition, in order to ensure data security and controllable access, the created distributed storage space needs to be configured with access rights and access credentials. Access rights define the users or applications that are allowed to access the storage space, as well as the operations that are allowed to be performed on the distributed storage space. Access credentials (such as access keys and tokens) are authentication credentials that users or applications need to provide when accessing the storage space to ensure that only authorized parties can read and write data.

[0075] Through this series of steps, customized storage solutions can be dynamically provided for each user or development task, ensuring sufficient space and performance to process data while maintaining data security and access control. This helps improve development efficiency, reduce storage costs, and achieve more flexible and optimized resource management under the Serverless model of Function Compute.

[0076] Optionally, in the code execution method provided in Example 1 of the present application, a target function instance is created based on a cloud development environment, including: receiving code information uploaded by a target user; creating a target function instance through the cloud development environment based on the code information; and mounting a distributed storage space to the target function instance based on access credentials.

[0077] In the first embodiment, after the target user completes code writing or modification in the personal development environment, the target user can upload the code information to the cloud development environment through the save, upload or submit function on the IDE interface. The code information received by the function computing platform may include the changed code files, project structure, dependent libraries, etc.

[0078] After receiving the code information, the function computing platform will quickly create or wake up a target function instance based on the target user's current cloud development environment configuration to run the code uploaded by the target user. The target function instance is a running container on the function computing platform that can provide the necessary computing resources and environment to execute the code. If the target user already has an active function instance, the function computing platform can use it directly; if not, a new function instance will be created.

[0079] Then, in order to enable the target function instance to access the code and other development resources uploaded by the target user, the target user's exclusive distributed storage space will be mounted to the target function instance using the access credentials (such as storage access keys) provided by the target user. This is equivalent to creating a link to the distributed storage space in the function instance, allowing the function instance to read and write data in the storage space like reading and writing local files. The mounting process ensures persistent storage of the code and shared access across function instances.

[0080] Secondly, the target function instance has all the conditions to run the user code, including the correct environment configuration and necessary code files. At this point, the target function instance will load the code information uploaded by the user and execute the code logic according to the instructions of the IDE (such as compiling, running, testing code, etc.). During the execution process, the target function instance can call the mounted distributed storage space to read the code, save the results, or load dependent resources.

[0081] Finally, after the target function instance executes the user code, it returns the execution results (such as running output, compilation errors, test reports, etc.) to the cloud development environment, which then displays them to the target user through the web interface. The target user can view the execution status of the code in the IDE interface for debugging, optimization, or further development.

[0082] Through this process, the target user can upload and run the code without worrying about the underlying computing resources, and use the elastic scaling characteristics of the function computing platform to achieve efficient and flexible code development and testing. At the same time, by mounting the distributed storage space to the target function instance, the storage security and access consistency of the code are ensured.

[0083] Optionally, in the code execution method provided in Example 1 of the present application, after accessing the cloud development environment through an HTTP trigger in a browser, the method further includes: determining whether there is a target function instance in a running state in the cloud development environment to obtain a judgment result; when the judgment result indicates that the target function instance is not in a running state, creating a target function instance, and executing the target user's code to be executed through the target function instance; when the judgment result indicates that the target function instance is in a running state, executing the target user's code to be executed through the target function instance.

[0084] In the first embodiment, when the target user accesses the cloud development environment through the web interface or API, it is first checked whether the target function instance associated with the target user is in the running state. This judgment is completed by querying the state management service of the function computing platform, and the real-time state of the instance can be obtained, including whether it is running, paused, stopped or destroyed.

[0085] If the judgment result indicates that the target function instance is not currently running (for example, the instance is stopped or does not exist), a new target function instance will be created immediately. This new target function instance will be created based on the cloud development environment parameters previously configured by the target user, such as memory, CPU, IDE type, etc. At the same time, the distributed storage space corresponding to the target user will be mounted to the new instance to ensure the continuity and consistency of code and resources.

[0086] If the target function instance is already running, it will be used directly to execute the user code without creating a new instance. This can quickly respond to the target user's request, improve code processing efficiency, and save resource consumption.

[0087] After successfully creating the target function instance, the function computing platform will start the target function instance and load the cloud development environment. This may include running the web version of the IDE program, configuring the network environment, loading user code and project files, etc. After the startup is complete, the target function instance is ready to respond to the user's code execution request.

[0088] Once the target function instance is in the running state, whether it is newly created or already exists, the target user's code to be executed will be executed through the target function instance. The target user can send code execution instructions such as run, debug, compile, etc. through the IDE interface, and these instructions will be processed by the IDE program in the target function instance. The distributed storage space in the target function instance will be used to read and save code, load dependent libraries, store execution results, etc.

[0089] Through this mechanism, the Function Compute Platform can provide an efficient and flexible resource management method, ensuring that target users can obtain a responsive and accurately configured development environment every time they access the cloud development environment. It fully utilizes the elastic scaling characteristics of the Serverless architecture and provides users with a low-threshold, high-efficiency cloud development experience.

[0090] Optionally, in the code execution method provided in Example 1 of the present application, after executing the target user's to-be-executed code through the target function instance, the above method also includes: determining a first moment when the target user sends a first request, wherein the first request represents a request for execution of the code sent by the target user to the cloud development environment; determining a second moment when the target user sends a second request, wherein the second request represents the next request for execution of the code sent by the target user to the cloud development environment after the first moment; and releasing the resources occupied by the target function instance when the interval between the second moment and the first moment is greater than a preset duration.

[0091] In the first embodiment, the function computing platform records the time point when the target user first sends a request to execute the code (i.e., the first request), i.e., the above-mentioned "first moment". The first request can be clicking the "Run", "Save", or "Test" button in the application interface of the cloud development environment through a browser, or a code execution instruction sent through an API call.

[0092] Next, the function computing platform continuously monitors the target user's activities and records the time when the target user sends another code execution request (i.e., the second request), which is the "second moment" mentioned above. The second request can occur at any time after the first request, provided that the target user is still working in his cloud development environment.

[0093] Then, the second moment is compared with the first moment, and the time difference between the two is calculated, that is, the interval between the two code execution requests sent by the target user. The function computing platform presets a time threshold, that is, the preset time mentioned above, which is used to determine whether the target user is inactive for a long time. If the interval between the second moment and the first moment exceeds the preset time, it means that a long time has passed since the target user last executed the code, and the target user may have stopped development work.

[0094] Finally, after determining that the target user has not used the cloud development environment for a long time, the resource release operation will be performed. This includes stopping the target function instance, reclaiming the computing resources it occupies (such as CPU, memory), and releasing the mount connection with the distributed storage space to release the storage resource occupation. This operation ensures the effective use of resources and avoids the waste of resources during the user's inactivity.

[0095] By implementing this strategy, the Function Compute platform can manage resources more intelligently, improve overall resource utilization, and reduce user costs, because computing and storage resources are consumed only when the target users actually use the cloud development environment. This mechanism fully utilizes the elastic scaling characteristics of the Serverless architecture and provides users with an efficient and economical way to use the development environment.

[0096] Optionally, in the code execution method provided in Example 1 of the present application, after creating an HTTP trigger based on the target function instance, the method further includes: determining N function instances in the cloud development environment, wherein the N function instances represent function instances in a running state in the cloud development environment, and N is an integer greater than or equal to 0; determining resource occupancy information of each of the N function instances; and adjusting the resource information occupied by each of the N function instances based on a preset load balancing algorithm and the resource occupancy information of each function instance.

[0097] In the first embodiment of the present invention, the function computing platform first identifies and determines all function instances in the current cloud development environment that are in operation, that is, the N function instances mentioned above. These function instances may be created for different users or different development tasks of the same user. Here N is a statistical variable representing the number of function instances in operation, and N can be any integer greater than or equal to 0. For the determined N function instances, it is necessary to collect resource occupancy information of each instance. Resource occupancy information typically includes CPU usage, memory usage, network bandwidth usage, and storage space usage. These data can help the system understand the real-time resource consumption of each function instance.

[0098] Based on the preset load balancing algorithm and the resource occupancy information of each function instance, the resource information occupied by each instance in N function instances is automatically adjusted. This process is usually completed automatically by the resource management service of the function computing platform without user intervention. The adjustment may take effect immediately or at the beginning of the next running cycle of the function instance, depending on the resource adjustment strategy and algorithm implementation of the platform. This may include dynamically increasing or decreasing the number of CPU cores of the instance, adjusting memory allocation, optimizing network configuration, or adjusting storage access permissions. Through adjustments, the resource occupancy level of all running function instances is kept within a preset reasonable range to avoid resource bottlenecks or waste. The function computing platform has a preset set of load balancing algorithms for analyzing and deciding how to allocate resources between function instances to achieve the best resource utilization efficiency and performance. The load balancing algorithm may be based on a variety of strategies, such as the resource occupancy ratio of the instance, the frequency of user requests, the delay of code execution, etc. The goal is to make resource allocation more even and avoid some instances being too busy while other instances have idle resources.

[0099] By dynamically monitoring and adjusting the resource usage of running function instances, the function computing platform can achieve more efficient and fairer resource allocation, ensuring that all users can get a good development experience when using the cloud development environment, while reducing the overall cost of resources, because resources can be adjusted according to actual needs, avoiding the problem of over-configuration under fixed resource allocation. This strategy makes full use of the elasticity and on-demand allocation characteristics of resources under the Serverless architecture, improving the resource utilization efficiency and response speed of the entire system.

[0100] Optionally, in this embodiment 1, Figure 3 This is a flow chart of a user accessing a function computing platform provided according to the first embodiment of the present application. Figure 3The steps in the process start with the user authenticating through an API key or OAuth token as part of the user registration and login process. Once authenticated, the user can express their development requirements and configuration information, such as selecting a programming language, specifying a project type, and setting a storage space size. After receiving this information, the cloud development environment creates a distributed storage space specifically for the user to store the code and development environment status, ensuring the security and accessibility of the code. Next, based on the configuration information provided by the user, a function instance running the cloud development environment is created, and the previously created distributed storage space is automatically mounted to the function instance. This allows users to edit and develop code directly in a web browser without installing any software. Subsequently, a unique web address is generated through an HTTP trigger for users to access their cloud development environment. Users access this web address through a web browser to access the cloud development environment for development. During user use, the cloud development environment continuously monitors the resource usage of the function instance and automatically reclaims resources when the computing resource usage is below the preset threshold to optimize resource efficiency and cost. In this way, the platform can dynamically adjust resource allocation to ensure that all users can get the necessary computing resources while avoiding resource waste.

[0101] Optionally, in this embodiment 1, Figure 4 This is a flowchart of a user executing code through a function computing platform provided in Example 1 of the present application. Figure 4 The detailed process of quickly starting a function instance based on user configuration information is further demonstrated. First, the function computing platform preheats the type of function instance that may be needed before the user requests it. This preheating mechanism predicts the type of development environment that the user may need based on historical user access patterns. After the preheating is completed, when the user makes a request, the function computing platform can immediately provide the preheated function instance, greatly reducing the startup time. Through this quick startup method, users can enter the development environment almost seamlessly, significantly improving development efficiency and user experience.

[0102] Optionally, in this embodiment 1, Figure 5 It is a schematic diagram of the relationship between users and function instances provided according to the first embodiment of the present application. Figure 5It describes the relationship between the user and the IDE function. The user (User) accesses the web address provided by the cloud IDE through a web browser and establishes a connection with the function instance (Function Instance). The function instance loads the corresponding IDE program according to the code and development environment status in the distributed storage space (Distributed Storage Space) mounted on it. Users can edit, compile and run the code in the web interface, and all operations and data changes will be synchronized to the distributed storage space in real time to ensure data consistency and persistence.

[0103] Figure 3 , Figure 4 and Figure 5 Through API key or OAuth token authentication, the uniqueness and security of user access is guaranteed, unauthorized access is prevented, and the security of user code and configuration information is protected. Secondly, the creation and mounting of distributed storage space enables users to switch seamlessly between multiple devices or multiple sessions without worrying about code loss or version inconsistency, which improves the flexibility of code management.

[0104] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0105] In summary, the code execution method provided in the embodiment of the present application creates a cloud development environment upon receiving a login instruction of a target user, wherein the login instruction represents an instruction for the target user to log in to a function computing platform; creates a target function instance based on the cloud development environment, wherein the target function instance represents a function instance for executing the target user's code to be executed; creates an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; accesses the cloud development environment through the HTTP trigger in a browser, and executes the target user's code to be executed through the target function instance, thereby solving the problem in the related art that the traditional code execution environment depends on the hardware resources of the local computer, requires repeated complex environment construction and maintenance, and leads to reduced code execution efficiency.

[0106] By receiving the login instructions sent by the target user and creating a cloud development environment and target function instance, users can start development work immediately without managing the underlying server, waiting for environment configuration or resource preheating, so that users can focus on writing code and developing logic, improving development efficiency and user experience. At the same time, by creating HTTP triggers for each target function instance, users can directly access their cloud development environment in the browser of any device without installing specific software or clients, eliminating the tedious steps of compilation, packaging, deployment, etc. commonly seen in traditional development environments, making the code testing and debugging process smoother and more efficient, greatly improving the flexibility of IDE use, and thus achieving the effect of improving code processing efficiency. In addition, each user has an independent target function instance and HTTP trigger, which provides natural isolation and security protection to prevent the code or resources of different users from affecting each other.

[0107] Example 2

[0108] The embodiment of the present application also provides a code execution device. It should be noted that the code execution device of the embodiment of the present application can be used to execute the code execution method provided by the embodiment of the present application. The code execution device provided by the embodiment of the present application is introduced below.

[0109] According to an embodiment of the present application, a device for implementing the above-mentioned code execution method is also provided, such as Figure 6 As shown, the device comprises:

[0110] Specifically, the first creation unit 601 is used to create a cloud development environment when receiving a login instruction from a target user, wherein the login instruction represents an instruction for the target user to log in to the function computing platform.

[0111] The second creation unit 602 is used to create a target function instance according to the cloud development environment, wherein the target function instance represents a function instance used to execute the to-be-executed code of the target user.

[0112] The third creation unit 603 is used to create an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol.

[0113] The first execution unit 604 is used to access the cloud development environment through an HTTP trigger in a browser, and execute the target user's to-be-executed code through a target function instance.

[0114] The code execution device provided in the embodiment of the present application creates a cloud development environment through the first creation unit 601 when receiving the login instruction of the target user, wherein the login instruction represents the instruction for the target user to log in to the function computing platform; the second creation unit 602 creates a target function instance based on the cloud development environment, wherein the target function instance represents the function instance used to execute the target user's to-be-executed code; the third creation unit 603 creates an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; the first execution unit 604 accesses the cloud development environment through the HTTP trigger in the browser, and executes the target user's to-be-executed code through the target function instance, which solves the problem in the related art that the traditional code execution environment depends on the hardware resources of the local computer, and requires repeated complex environment construction and maintenance, resulting in reduced code execution efficiency.

[0115] By receiving the login instructions sent by the target user and creating a cloud development environment and target function instance, users can start development work immediately without managing the underlying server, waiting for environment configuration or resource preheating, so that users can focus on writing code and developing logic, improving development efficiency and user experience. At the same time, by creating HTTP triggers for each target function instance, users can directly access their cloud development environment in the browser of any device without installing specific software or clients, eliminating the tedious steps of compilation, packaging, deployment, etc. commonly seen in traditional development environments, making the code testing and debugging process smoother and more efficient, greatly improving the flexibility of IDE use, and thus achieving the effect of improving code processing efficiency. In addition, each user has an independent target function instance and HTTP trigger, which provides natural isolation and security protection to prevent the code or resources of different users from affecting each other.

[0116] Optionally, in the code execution device provided in Example 2 of the present application, the above-mentioned first creation unit 601 includes: a verification subunit, used to extract user information of the target user in the login instruction, and verify the user information to obtain a verification result; a determination subunit, used to determine the configuration information of the target user when the verification result indicates that the verification is passed, wherein the configuration information includes at least: configuration information of the cloud development environment, storage configuration information; a first creation subunit, used to create a distributed storage space based on the storage configuration information; a second creation subunit, used to create a cloud development environment based on the distributed storage space and the configuration information of the cloud development environment.

[0117] Optionally, in the code execution device provided in Example 2 of the present application, the above-mentioned determination sub-unit includes: a receiving module, used to receive the development task information of the target user, and determine the data processing scope involved in the development task information; a determination module, used to determine the storage configuration information based on the data processing scope; the first creation sub-unit includes: a module, used to create a distributed storage space based on the storage configuration information, and configure the access rights and access credentials of the distributed storage space.

[0118] Optionally, in the code execution device provided in Example 2 of the present application, the above-mentioned second creation unit 602 includes: a receiving sub-unit, used to receive code information uploaded by the target user; a third creation sub-unit, used to create a target function instance through a cloud development environment based on the code information; and a mounting sub-unit, used to mount the distributed storage space to the target function instance based on the access credentials.

[0119] Optionally, in the code execution device provided in Example 2 of the present application, the above-mentioned device also includes: a judgment unit, which is used to judge whether there is a target function instance in a running state in the cloud development environment after accessing the cloud development environment through an HTTP trigger in a browser, and obtain a judgment result; a fourth creation unit, which is used to create a target function instance when the judgment result indicates that the target function instance is not in a running state, and execute the target user's code to be executed through the target function instance; a second execution unit, which is used to execute the target user's code to be executed through the target function instance when the judgment result indicates that the target function instance is in a running state.

[0120] Optionally, in the code execution device provided in Example 2 of the present application, the above-mentioned device also includes: a first determination unit, used to determine the first moment when the target user sends a first request after executing the target user's to-be-executed code through the target function instance, wherein the first request represents the request for execution of the code sent by the target user to the cloud development environment; a second determination unit, used to determine the second moment when the target user sends a second request, wherein the second request represents the next request for execution of the code sent by the target user to the cloud development environment after the first moment; and a release unit, used to release the resources occupied by the target function instance when the interval between the second moment and the first moment is greater than a preset duration.

[0121] Optionally, in the code execution device provided in Example 2 of the present application, the above-mentioned device also includes: a third determination unit, used to determine N function instances in the cloud development environment after creating an HTTP trigger based on the target function instance, wherein the N function instances represent function instances in a running state in the cloud development environment, and N is an integer greater than or equal to 0; a fourth determination unit, used to determine resource occupancy information of each function instance in the N function instances; and an adjustment unit, used to adjust the resource information occupied by each function instance in the N function instances according to a preset load balancing algorithm and the resource occupancy information of each function instance.

[0122] It should be noted here that the above-mentioned first creation unit 601, second creation unit 602, third creation unit 603 and first execution unit 604 correspond to steps S201 to S204 in Example 1, and the two modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102 code execution, ..., 102n), and the above-mentioned modules can also be part of the device and can be run in the computer terminal 10 provided in Example 1.

[0123] Example 3

[0124] An embodiment of the present application may provide an electronic device, Figure 7 is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 7 As shown, the electronic device may include: one or more ( Figure 7 (only one is shown) processor 702, memory 704, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0125] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0126] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: upon receiving a login instruction from the target user, create a cloud development environment, wherein the login instruction represents an instruction for the target user to log in to the function computing platform; create a target function instance based on the cloud development environment, wherein the target function instance represents a function instance for executing the target user's code to be executed; create an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; access the cloud development environment through the HTTP trigger in the browser, and execute the target user's code to be executed through the target function instance.

[0127] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: when receiving the login instruction of the target user, create a cloud development environment, including: extracting the user information of the target user in the login instruction, and verifying the user information to obtain a verification result; when the verification result indicates that the verification is passed, determine the configuration information of the target user, wherein the configuration information includes at least: configuration information of the cloud development environment, storage configuration information; create a distributed storage space based on the storage configuration information; create a cloud development environment based on the distributed storage space and the configuration information of the cloud development environment.

[0128] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: when receiving the login instruction of the target user, create a cloud development environment, including: extracting the user information of the target user in the login instruction, and verifying the user information to obtain a verification result; when the verification result indicates that the verification is passed, determine the configuration information of the target user, wherein the configuration information includes at least: configuration information of the cloud development environment, storage configuration information; create a distributed storage space based on the storage configuration information; create a cloud development environment based on the distributed storage space and the configuration information of the cloud development environment.

[0129] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the configuration information of the target user, and create a distributed storage space based on the storage configuration information, including: receiving the development task information of the target user, and determining the data processing scope involved in the development task information; determining the storage configuration information based on the data processing scope; creating a distributed storage space based on the storage configuration information, and configuring the access rights and access credentials of the distributed storage space.

[0130] The processor can call the information and applications stored in the memory through the transmission device to perform the following steps: create a target function instance based on the cloud development environment, including: receiving code information uploaded by the target user; creating a target function instance through the cloud development environment based on the code information; mounting the distributed storage space to the target function instance based on the access credentials.

[0131] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: After accessing the cloud development environment through the HTTP trigger in the browser, the above method also includes: determining whether there is a target function instance in a running state in the cloud development environment, and obtaining a determination result; when the determination result indicates that the target function instance is not in a running state, creating a target function instance, and executing the target user's code to be executed through the target function instance; when the determination result indicates that the target function instance is in a running state, executing the target user's code to be executed through the target function instance.

[0132] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: After executing the target user's to-be-executed code through the target function instance, the above method also includes: determining a first moment when the target user sends a first request, wherein the first request represents a request for execution of the code sent by the target user to the cloud development environment; determining a second moment when the target user sends a second request, wherein the second request represents the next request for execution of the code sent by the target user to the cloud development environment after the first moment; and releasing the resources occupied by the target function instance when the interval between the second moment and the first moment is greater than a preset duration.

[0133] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: After creating an HTTP trigger based on the target function instance, the above method also includes: determining N function instances in the cloud development environment, wherein the N function instances represent function instances in running state in the cloud development environment, and N is an integer greater than or equal to 0; determining resource occupancy information of each function instance in the N function instances; and adjusting the resource information occupied by each function instance in the N function instances according to a preset load balancing algorithm and the resource occupancy information of each function instance.

[0134] According to an embodiment of the present application, a code execution method is provided. By creating a cloud development environment upon receiving a login instruction of a target user, wherein the login instruction represents an instruction for the target user to log in to a function computing platform; creating a target function instance according to the cloud development environment, wherein the target function instance represents a function instance for executing the target user's to-be-executed code; creating an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; accessing the cloud development environment through the HTTP trigger in a browser, and executing the target user's to-be-executed code through the target function instance, thereby solving the technical problem that the traditional code execution environment depends on the hardware resources of the local computer, requires repeated complex environment construction and maintenance, and leads to reduced code execution efficiency.

[0135] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only, and the electronic device may also be a terminal device such as a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Moile Internet Devices, MID), a PAD, etc. Figure 7 The structure of the electronic device is not limited. Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 7 Different configurations are shown.

[0136] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0137] Example 4

[0138] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the code execution method provided in the first embodiment.

[0139] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0140] The present application also provides a computer program product which, when executed on a data processing device, is suitable for executing the program of the code execution method steps.

[0141] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0142] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0143] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

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

[0145] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0146] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0147] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A code execution method, characterized in that: include: Upon receiving a login instruction from a target user, creating a cloud development environment, wherein the login instruction represents an instruction for the target user to log in to a function computing platform; Creating a target function instance according to the cloud development environment, wherein the target function instance represents a function instance for executing the code to be executed by the target user; Creating an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through the HTTP protocol; The cloud development environment is accessed in a browser through the HTTP trigger, and the target user's code to be executed is executed through the target function instance.

2. The method according to claim 1, characterized in that Upon receiving the login instruction from the target user, create a cloud development environment, including: Extracting user information of the target user in the login instruction, and verifying the user information to obtain a verification result; If the verification result indicates that the verification is passed, determining the configuration information of the target user, wherein the configuration information at least includes: configuration information of the cloud development environment and storage configuration information; Creating a distributed storage space according to the storage configuration information; The cloud development environment is created based on the distributed storage space and the configuration information of the cloud development environment.

3. The method according to claim 2, characterized in that Determining the configuration information of the target user, and creating a distributed storage space according to the storage configuration information, including: receiving development task information of the target user, and determining a data processing scope involved in the development task information; Determining the storage configuration information according to the data processing scope; The distributed storage space is created according to the storage configuration information, and access rights of the distributed storage space and access credentials of the distributed storage space are configured.

4. The method according to claim 3, characterized in that: Creating an objective function instance according to the cloud development environment includes: Receiving code information uploaded by the target user; Creating the objective function instance through the cloud development environment based on the code information; The distributed storage space is mounted to the target function instance based on the access credential.

5. The method according to claim 1, characterized in that After accessing the cloud development environment through the HTTP trigger in the browser, the method further includes: Determine whether there is an instance of the objective function currently in operation in the cloud development environment, and obtain a determination result; When the judgment result indicates that the target function instance is not in a running state, creating the target function instance, and executing the target user's to-be-executed code through the target function instance; When the judgment result indicates that the target function instance is in a running state, the code to be executed by the target user is executed through the target function instance.

6. The method according to claim 1, characterized in that After executing the target user's to-be-executed code through the target function instance, the method further includes: Determine a first time at which the target user sends a first request, wherein the first request represents a request for executing code sent by the target user to the cloud development environment; Determine a second time at which the target user sends a second request, wherein the second request represents a next request for executing code sent by the target user to the cloud development environment after the first time; When the interval between the second moment and the first moment is greater than a preset duration, the resources occupied by the objective function instance are released.

7. The method according to claim 1, characterized in that After creating an HTTP trigger based on the target function instance, the method further includes: Determine N function instances in the cloud development environment, wherein the N function instances represent function instances in a running state in the cloud development environment, and N is an integer greater than or equal to 0; Determine resource occupancy information of each function instance in the N function instances; According to a preset load balancing algorithm and the resource occupancy information of each function instance, the resource information occupied by each function instance in the N function instances is adjusted respectively.

8. A code execution device, characterized in that: include: A first creation unit is configured to create a cloud development environment upon receiving a login instruction from a target user, wherein the login instruction represents an instruction for the target user to log in to a function computing platform; A second creation unit is used to create a target function instance according to the cloud development environment, wherein the target function instance represents a function instance for executing the to-be-executed code of the target user; A third creation unit, configured to create an HTTP trigger based on the target function instance, wherein the HTTP trigger is used to trigger the execution of the target function instance through an HTTP protocol; The first execution unit is used to access the cloud development environment through the HTTP trigger in the browser, and execute the to-be-executed code of the target user through the target function instance.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is run, the device where the computer-readable storage medium is located is controlled to execute the code execution method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 7 when running.