A method and device for batch creation of function sandboxes for fast network recovery

By adding network address translation protocol code to the virtual machine monitor, the startup time and network address reuse issues of function sandboxes in serverless computing mode were resolved, enabling rapid batch creation and normal communication of function sandboxes, and improving the response speed of computing tasks.

CN117614928BActive Publication Date: 2026-07-21ZHEJIANG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG LAB
Filing Date
2023-11-16
Publication Date
2026-07-21

Smart Images

  • Figure CN117614928B_ABST
    Figure CN117614928B_ABST
Patent Text Reader

Abstract

The present specification discloses a method and device for implementing function sandbox batch creation for network fast recovery, a network address translation protocol code is added to a virtual machine monitor in advance, when a computing task is received, the number of function sandboxes required for executing the computing task is determined according to the computing task, a number of virtual network devices are created according to the computing task, function sandboxes are created in the environment of each virtual network device according to the snapshot file corresponding to the computing task and the virtual machine monitor to which the network address translation protocol code is added, an unused and different replacement address is selected for each created function sandbox, and the selected replacement address is distributed to each function sandbox, so that the communication function of the batch-created function sandboxes is ensured, the process of batch creating function sandboxes by the cloud computing platform is simplified, and the response speed of the computing task is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a method and apparatus for batch creation of function sandboxes to achieve fast network recovery. Background Technology

[0002] Cloud computing allows users to share computing resources via the cloud by renting servers. With the development of cloud computing, serverless computing has emerged. Unlike renting servers, in serverless computing, users only need to upload function code to the computing platform. When the platform receives the trigger command for the computing task corresponding to that function code, it automatically creates a function sandbox to execute the function code. When there are no computing tasks, the function sandbox does not need to be maintained, thus saving significant server overhead.

[0003] In real-world scenarios, many computational tasks have short execution times, making the startup time of function sandboxes in serverless computing a major factor affecting task response speed. While snapshot technology can save significant initialization time by creating function sandboxes, these sandboxes often fail to communicate properly due to network address reuse issues. Existing technologies require creating additional network namespaces for each function sandbox to address this problem, further impacting task response speed.

[0004] To address the above problems, this invention provides a method, apparatus, storage medium, and device for batch creation of function sandboxes. Summary of the Invention

[0005] This specification provides a method and apparatus for batch creation of function sandboxes to achieve rapid network recovery, thereby partially solving the aforementioned problems existing in the prior art.

[0006] The following technical solution is adopted in this specification:

[0007] This manual provides a method for batch creation of function sandboxes to achieve fast network recovery, including:

[0008] Add network address translation protocol code to the virtual machine monitor in advance;

[0009] When a computation task is received, the number of function sandboxes required to execute the computation task is determined based on the computation task.

[0010] Create the stated number of virtual network devices according to the stated computing task;

[0011] Based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, create function sandboxes in the environment of each virtual network device;

[0012] For each function sandbox created, select unused and distinct replacement addresses;

[0013] The selected replacement addresses are distributed to each function sandbox so that each function sandbox can communicate during the execution of the computation task based on its own replacement address.

[0014] Optionally, the method is applied to serverless computing platforms.

[0015] Optionally, the network address translation protocol is used to convert the destination address in the data packet from the replacement address received by the function sandbox to the initial address in the snapshot file when the function sandbox is created, when the function sandbox receives the data packet.

[0016] Optionally, the network address translation protocol is used to convert the source address in the data packet from the initial address in the snapshot file when the function sandbox is created to the replacement address received by the function sandbox when the function sandbox sends a data packet.

[0017] Optionally, the method further includes:

[0018] After completing the packet address translation, the header checksum in the packet frame header is recalculated and updated.

[0019] Optionally, based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, a function sandbox is created in the environment of each virtual network device, specifically including:

[0020] Based on the same snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, function sandboxes are created in the environment of each virtual network device, and the created function sandboxes are completely identical to each other.

[0021] Optionally, based on the computational task, the number of virtual network devices created specifically includes:

[0022] Based on the computing task, create a number of virtual network devices, not exceeding the stated number.

[0023] Based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, a function sandbox is created in the environment of each virtual network device, specifically including:

[0024] For any virtual network device model, based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, several function sandboxes are created in the environment of the virtual network device, wherein the sum of the number of function sandboxes created in the environment of each virtual network device satisfies the stated quantity.

[0025] This specification provides a device for batch creation of function sandboxes to achieve rapid network recovery. The virtual machine monitor has pre-added network address translation protocol code. The device includes:

[0026] The determination module, upon receiving a computation task, determines the number of function sandboxes required to execute the computation task based on the computation task.

[0027] The network device creation module creates the specified number of virtual network devices based on the computing task.

[0028] The function sandbox creation module creates function sandboxes in the environment of each virtual network device based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added.

[0029] The address selection module selects unused and distinct replacement addresses for each function sandbox created;

[0030] The address distribution module distributes the selected replacement addresses to each function sandbox, so that each function sandbox can complete communication normally during the execution of the computing task based on its own replacement address.

[0031] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for batch creation of sandbox functions.

[0032] This specification provides an apparatus including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for batch creation of the above-described function sandbox.

[0033] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:

[0034] In the method for batch creation of function sandboxes to achieve fast network recovery provided in this specification, network address translation protocol code is added to the virtual machine monitor in advance. When a computing task is received, the number of function sandboxes required to execute the computing task is determined according to the computing task. The number of virtual network devices is created according to the computing task. Based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, function sandboxes are created in the environment of each virtual network device. Unused and different replacement addresses are selected for each created function sandbox. The selected replacement addresses are distributed to each function sandbox so that each function sandbox can complete communication during the execution of the computing task based on its own replacement address.

[0035] As can be seen from the above method, this method ensures the normal communication function of the batch-created function sandboxes by adding network address translation protocol code to the virtual machine monitor in advance, which simplifies the process of batch creating function sandboxes on the cloud computing platform and speeds up the response speed of computing tasks. Attached Figure Description

[0036] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:

[0037] Figure 1 This is a flowchart illustrating a method for batch creation of function sandboxes to achieve fast network recovery, as described in this specification.

[0038] Figure 2 This is a schematic diagram of the system architecture of the computing platform in this specification;

[0039] Figure 3 This document provides a schematic diagram of a function sandbox batch creation device for achieving rapid network recovery.

[0040] Figure 4 The corresponding information provided in this specification Figure 1 A schematic diagram of an electronic device. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without creative effort are within the scope of protection of this application.

[0042] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0043] In cloud computing, users do not need to hold computing resources offline. They only need to deploy the functions they want to execute on the cloud computing platform. When the triggering conditions of the computing function are met (i.e., the computing platform receives the computing task), the computing platform will automatically create a function sandbox and load the function code submitted by the user to execute the computing task. The technical solution provided in this specification is applied to a cloud computing platform. In one or more specific implementations of this specification, the computing platform is a serverless computing platform. When the function is deployed but not triggered, the serverless computing platform does not need to create and maintain a function sandbox for executing the function, thereby saving most of the server overhead in a conventional cloud computing platform. In the solution provided in this specification, after the user submits the creation script corresponding to the function (the creation script includes the code of the function to be executed by the computation task and a snapshot file for creating the virtual machine in the function sandbox; the creation script may also only contain the code of the function to be executed by the computation task, so that after the function is executed for the first time, the computing platform can automatically create a snapshot file according to the function sandbox executing the function), the computing platform can provide a virtual machine monitor with added Network Address Translation Protocol (NAT) code, so that the function sandbox created in subsequent steps can use the replacement address to complete communication according to the NAT. The virtual machine monitor can be used to complete the creation of the function sandbox together with the creation script. The function can be an application for continuous interaction with visitors in the business process, or an application for performing tasks such as model training and function computation, depending on the needs of the user deploying the function; this specification does not impose any restrictions on this.

[0044] Figure 1 This is a flowchart illustrating a method for batch creation of function sandboxes to achieve fast network recovery, as described in this specification. The method specifically includes the following steps:

[0045] S100: When a computing task is received, determine the number of function sandboxes required to execute the computing task based on the computing task.

[0046] Upon receiving a computing task, the computing platform can determine the number of function sandboxes required to execute that task. The method for determining the number of function sandboxes can be based on the data volume of the computing task preset when the user deploys the functions to be executed, thus determining the number of function sandboxes needed for that data volume; alternatively, it can be based on the data volume identifier carried in the trigger command corresponding to the received computing task, thus determining the number of function sandboxes needed for the data volume corresponding to that identifier. This specification does not impose any limitations on this method.

[0047] S102: Create the stated number of virtual network devices according to the computing task.

[0048] After determining the number of function sandboxes required to perform the computation task, create the corresponding number of virtual network devices, ensuring a one-to-one correspondence between the created virtual network devices and the function sandboxes to be created. These created virtual network devices can be TAP / TUN devices, such as... Figure 2 As shown, the TAP / TUN device connects to the bridge device of the computing platform, providing a connection between the host kernel and the application layer. In the solution provided in this specification, the host kernel is the operating system kernel in the computing platform (managing physical devices or nodes used to provide computing resources), and the application layer is the function sandbox (i.e., the virtual machine built in the virtual machine monitor in the figure). In the conventional function sandbox creation scheme based on the snapshot mechanism, before creating the virtual network device, it is necessary to set up a separate network namespace for each virtual network device. This way, when the network addresses of the created function sandboxes are the same in subsequent steps, the network address can be translated by the network firewall (iptables) rules set when the network namespace is created, so that the function sandboxes can communicate normally. However, creating a network namespace requires establishing a veth device pair between the newly created network namespace and the host network namespace, and setting independent network firewall rules and routing rules for each newly created network namespace. This network namespace creation process greatly increases the response time of the computing task. The method provided in this specification accelerates the creation of function sandboxes by circumventing this technical route of creating network namespaces.

[0049] S104: Based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, create a function sandbox in the environment of each virtual network device.

[0050] After creating all virtual network devices, for each virtual network device, a function sandbox is created in the environment of that virtual network device based on the snapshot file corresponding to the computing task and a virtual machine monitor with network address translation protocol pre-added. (First, the virtual machine monitor is set up, and then a virtual machine is created in the virtual machine monitor using the snapshot file. The virtual machine created by the virtual machine monitor based on the snapshot file is used as the function sandbox.) The snapshot file is a snapshot of a virtual machine (here denoted as virtual machine 01) capable of executing the function corresponding to the computing task. Specifically, virtual machine 01 can be a function sandbox historically used to execute the computing task. The snapshot file records the virtual disk state, virtual machine memory state, and virtual machine configuration information of virtual machine 01. Therefore, each virtual machine created by the virtual machine monitor based on the snapshot file has the same configuration information and software environment as virtual machine 01, eliminating the need for additional initialization of the created function sandbox (including kernel initialization and function program initialization). This method of batch creating function sandboxes based on snapshot files also reduces the time spent initializing each function sandbox after creation. Each virtual network device can create a function sandbox using the same snapshot file and a virtual machine monitor with the network address translation protocol code added, or it can create a function sandbox using different snapshot files and virtual machine monitors with the network address translation protocol code added. This specification does not impose any restrictions on this. The virtual machine monitor created can be any virtual machine monitor with packet forwarding capabilities, including Kata Containers, Firecracker, etc. This specification does not impose any restrictions on this.

[0051] In one or more embodiments of this specification, function sandboxes are created in the environment of each virtual network device based on the same snapshot file corresponding to the computing task and a virtual machine monitor with the network address translation protocol code added. The created function sandboxes are completely identical to each other.

[0052] When a received computation task corresponds to only one snapshot file, each virtual network device creates a function sandbox in its environment based on the same snapshot file and a virtual machine monitor with the network address translation protocol code added. This snapshot file allows for the fastest batch creation of function sandboxes. However, the virtual machine configuration information recorded in each function sandbox created from the same snapshot file is identical, including network addresses. This means that each function sandbox has the same initial address after creation from the same snapshot file, preventing normal communication. Subsequent steps are needed to assign replacement addresses to each function sandbox. The network address includes both IP and MAC addresses. The replacement address, initial address, destination address, and source address mentioned in this specification all contain both IP and MAC addresses.

[0053] S106: Select unused and distinct replacement addresses for each function sandbox created.

[0054] To ensure that each function sandbox can communicate normally, after the function sandbox is created, the computing platform selects an equal number of unused network addresses from its own network address pool as replacement addresses for each function sandbox. This ensures that each set of replacement addresses is unique (both IP addresses and MAC addresses are unique), thus serving as a unique identifier for each function sandbox when communicating with the outside world.

[0055] S108: Distribute the selected replacement address to each function sandbox so that each function sandbox can complete communication normally during the execution of the computation task based on its own replacement address.

[0056] Once the computing platform selects replacement addresses for each function sandbox, it can distribute these replacement addresses to each sandbox using the virtual network devices created in step S102 that correspond one-to-one with the function sandboxes. This ensures that each function sandbox has a unique set of replacement addresses. Therefore, for any given function sandbox, during communication, the initial address can be replaced using the replacement address via the Network Address Translation Protocol (NAT) in the corresponding virtual machine monitor, thus enabling normal communication.

[0057] In one or more embodiments described herein, the network address translation protocol is specifically used to convert the destination address in the data packet from the replacement address received by the function sandbox to the initial address in the snapshot file when the function sandbox was created; when the function sandbox sends a data packet, it converts the source address in the data packet from the initial address in the snapshot file when the function sandbox was created to the replacement address received by the function sandbox; after completing the data packet address translation, the header checksum in the frame header of the data packet is recalculated and updated.

[0058] In essence, when any function sandbox needs to receive a data packet, the virtual machine monitor that creates and manages that function sandbox converts the destination address stored in the relevant protocol address field of the received data packet frame header from the alternative address used for external communication by that function sandbox to the initial address used within that function sandbox, according to a pre-added network address translation protocol. When any function sandbox needs to send a data packet, the virtual machine monitor converts the source address stored in the relevant protocol address field of the sent data packet frame header from the initial address used within that function sandbox to the alternative address used for external communication by that function sandbox. After the above data packet address translation process is completed, the header checksum in the data packet frame header is recalculated and updated to ensure the correctness of the header of the data packet used for communication. Thus, when each function sandbox communicates with the outside world, each function sandbox can be distinguished by its unique alternative address, and when receiving a data packet, the function sandbox can process data packets with a destination address as the initial address without changing the configuration generated based on the snapshot file.

[0059] In practical applications, data packets used for network communication are specifically divided into Address Resolution Protocol (ARP) data packets and IP protocol data packets. The process of changing the network address in the above communication is as follows:

[0060] When the virtual machine monitor receives a network packet, it attempts to extract the Ethernet frame header and uses the type field in the Ethernet frame header to determine whether it is an ARP protocol packet.

[0061] If the data packet is an ARP packet, the IP address stored in the relevant protocol address field in the ARP frame header determines whether address translation is needed. For data packets received from outside, if the destination protocol address in the ARP frame header is an IP address... 替换 Then address translation of the data packet is required; for data packets sent from the virtual machine, if the source protocol address in the ARP frame header is IP... 初始 Then address translation of the data packet is required;

[0062] When address translation of data packets is required, the corresponding MAC address in the Ethernet frame header is replaced; for data packets received from external sources, the destination MAC address is changed from the MAC address in the header. 替换 Replace with MAC 初始 For data packets sent from a virtual machine, the source MAC address is changed from the MAC address. 初始 Replace with MAC 替换 Similarly, replace the corresponding address in the ARP frame header; for packets received from outside, replace the destination protocol address in the ARP frame header with the IP address. 替换 Replace with IP 初始 Meanwhile, if the opcode field in the ARP frame header is 2 (i.e., ARP reply), then the destination hardware address in the ARP frame header will be changed from the MAC address. 替换 Replace with MAC 初始 For data packets sent from a virtual machine, the source hardware address and source protocol address in the ARP frame header are then extracted from the MAC address. 初始 and IP 初始 Replace with MAC 替换 and IP 替换 .

[0063] If the data packet is an IP protocol packet, the IP address stored in the relevant IP address field in the IP frame header determines whether address translation is needed. For data packets received from outside, if the destination IP address in the IP frame header is an IP address... 替换 Then address translation of the data packet is required; for data packets sent from the microvirtual machine, if the source IP address in the IP frame header is IP... 初始 Then address translation of the data packet is required;

[0064] When address translation of data packets is required, the corresponding MAC address in the Ethernet frame header is replaced; for data packets received from external sources, the destination MAC address is changed from the MAC address in the header. 替换 Replace with MAC 初始 For data packets sent from a virtual machine, the source MAC address is changed from the MAC address. 初始 Replace with MAC 替换 Similarly, replace the corresponding address in the IP frame header; for packets received from outside, replace the destination IP address in the IP frame header with the IP address from the IP address field. 替换 Replace with IP 初始 For data packets sent from a virtual machine, the source IP address in the IP frame header is removed from the IP address. 初始 Replace with IP 替换 .

[0065] After completing the packet address translation, the IP header checksum of the IP protocol packet is recalculated to obtain the IP checksum.新 And update the header checksum in the IP frame to the IP checksum. 新 .

[0066] like Figure 1 The method shown is a batch creation method for achieving fast network recovery of function sandboxes. By pre-adding network address translation protocol code to the virtual machine monitor, the normal communication function of the batch-created function sandboxes is guaranteed, which simplifies the process of batch creation of function sandboxes on the cloud computing platform and speeds up the response speed of computing tasks.

[0067] In such Figure 1 In step S102, as shown, according to the computing task, a number of virtual network devices, not exceeding the stated number, are created, thereby enabling... Figure 1 In step S104, based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, a function sandbox is created in the environment of each virtual network device. Specifically, for any virtual network device model, based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, several function sandboxes are created in the environment of that virtual network device, wherein the sum of the number of function sandboxes created in the environment of each virtual network device satisfies the stated quantity.

[0068] Specifically, multiple function sandboxes can be created on the same virtual network device. For any virtual network device, a virtual machine monitor is first created using virtual machine monitor creation code in the environment provided by the virtual network device. Several function sandboxes are then created under the created virtual machine monitor. In subsequent steps, when distributing replacement addresses to each function sandbox, the computing platform distributes replacement addresses to the virtual network device in an amount equal to the number of function sandboxes under the virtual network device. The virtual network device then distributes the replacement addresses to its various function sandboxes.

[0069] The above describes a method for batch creation of function sandboxes for fast network recovery, provided by one or more embodiments of this specification. Based on the same idea, this specification also provides a corresponding apparatus for batch creation of function sandboxes for fast network recovery, such as... Figure 3 As shown.

[0070] Figure 3 This is a schematic diagram of a device for batch creation of function sandboxes to achieve fast network recovery, as provided in this specification. The virtual machine monitor of this device has pre-added network address translation protocol code, specifically including:

[0071] The determination module 300, upon receiving a computing task, determines the number of function sandboxes required to execute the computing task based on the computing task.

[0072] The network device creation module 302 creates the specified number of virtual network devices according to the computing task.

[0073] The function sandbox creation module 304 creates function sandboxes in the environment of each virtual network device based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added.

[0074] Address selection module 306 selects unused and distinct replacement addresses for each function sandbox created;

[0075] The address distribution module 308 distributes the selected replacement address to each function sandbox, so that each function sandbox can complete communication normally during the execution of the computing task based on its own replacement address.

[0076] Optionally, the device is applied to a serverless computing platform.

[0077] Optionally, the network address translation protocol is used to convert the destination address in the data packet from the replacement address received by the function sandbox to the initial address in the snapshot file when the function sandbox is created, when the function sandbox receives the data packet.

[0078] Optionally, the network address translation protocol is used to convert the source address in the data packet from the initial address in the snapshot file when the function sandbox is created to the replacement address received by the function sandbox when the function sandbox sends a data packet.

[0079] Optionally, the function sandbox creation module 304 is specifically used to: create function sandboxes in the environment of each virtual network device based on the same snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, wherein the created function sandboxes are completely identical to each other.

[0080] Optionally, the network device creation module 302 is specifically used to: create a number of virtual network devices, not exceeding the number specified, according to the computing task; and the function sandbox creation module 304 is specifically used to: for any virtual network device model, based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, create a number of function sandboxes in the environment of the virtual network device, wherein the sum of the number of function sandboxes created in the environment of each virtual network device satisfies the specified number.

[0081] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 Provides a function for batch creation of sandboxes to achieve fast network recovery.

[0082] This instruction manual also provides Figure 4 The diagram shows a schematic structural representation of the electronic device. Figure 4 At the hardware level, the devices created in batches by the function sandbox include processors, internal buses, network interfaces, memory, and non-volatile storage, and may also include other hardware required by the business logic. The processor reads the corresponding computer program from the non-volatile storage into memory and then runs it to achieve the above. Figure 1 The method for batch creation of function sandboxes to achieve fast network recovery is described above. Of course, besides software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution entity of the following processing flow is not limited to individual logic units, but can also be hardware or logic devices.

[0083] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages ​​and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.

[0084] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0085] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0086] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.

[0087] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0088] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0089] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0090] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0091] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0092] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0093] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0094] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0095] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0096] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0097] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0098] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this application.

Claims

1. A method for batch creation of function sandboxes to achieve fast network recovery, characterized in that, Pre-adding network address translation protocol code to the virtual machine monitor; the method includes: When a computation task is received, the number of function sandboxes required to execute the computation task is determined based on the computation task. Create the stated number of virtual network devices according to the stated computing task; Based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, create function sandboxes in the environment of each virtual network device; For each function sandbox created, select unused and distinct replacement addresses; The selected replacement addresses are distributed to each function sandbox so that each function sandbox can communicate during the execution of the computation task based on its own replacement address.

2. The method as described in claim 1, characterized in that, The method is applied to serverless computing platforms.

3. The method as described in claim 1, characterized in that, The network address translation protocol is used to convert the destination address in the data packet from the replacement address received by the function sandbox to the initial address in the snapshot file when the function sandbox was created, when the function sandbox receives the data packet.

4. The method as described in claim 1, characterized in that, The network address translation protocol is used to translate the source address in the data packet from the initial address in the snapshot file when the function sandbox is created to the replacement address received by the function sandbox when the function sandbox sends a data packet.

5. The method as described in claim 3 or 4, characterized in that, The method further includes: After completing the packet address translation, the header checksum in the packet frame header is recalculated and updated.

6. The method as described in claim 1, characterized in that, Based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, a function sandbox is created in the environment of each virtual network device, specifically including: Based on the same snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, function sandboxes are created in the environment of each virtual network device, and the created function sandboxes are completely identical to each other.

7. The method as described in claim 1, characterized in that, Based on the computational task, the creation of the stated number of virtual network devices specifically includes: Based on the computing task, create a number of virtual network devices, not exceeding the stated number. Based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, a function sandbox is created in the environment of each virtual network device, specifically including: For any virtual network device model, based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added, several function sandboxes are created in the environment of the virtual network device, wherein the sum of the number of function sandboxes created in the environment of each virtual network device satisfies the stated quantity.

8. A device for batch creation of function sandboxes to achieve fast network recovery, characterized in that, The virtual machine monitor has pre-added network address translation protocol code, and the device includes: The determination module, upon receiving a computation task, determines the number of function sandboxes required to execute the computation task based on the computation task. The network device creation module creates the specified number of virtual network devices based on the computing task. The function sandbox creation module creates function sandboxes in the environment of each virtual network device based on the snapshot file corresponding to the computing task and the virtual machine monitor with the network address translation protocol code added. The address selection module selects unused and distinct replacement addresses for each function sandbox created; The address distribution module distributes the selected replacement addresses to each function sandbox, so that each function sandbox can communicate during the execution of the computation task based on its own replacement address.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 7.

10. An apparatus comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method described in any one of claims 1 to 7.