Sandbox rapid creation method and system for server non-aware computing scene
By using the sandbox fork primitive to reuse the pre-initialized instance status in the server-free computing scenario, the problems of high-cold startup delay and low instance creation efficiency of the memory partition sandbox system are solved, and faster instance creation and reduction are achieved Cold start delay.
Patent Information
- Application Number
- CN202411176686.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-08-26
AI Technical Summary
The problems of high-cold startup delay and low instance creation efficiency of memory partition sandbox systems in specific scenarios in the prior art.
In the server-free computing scenario, by adding template instance cache pool components and Supervisor components to the CAP-VM memory partition sandbox system, the pre-initialized instance status is reused using the sandbox fork primitives to skip the sandbox instance cold start process , designed a memory partition sandbox rapid creation mechanism.
It reduces the sandbox cold start delay, improves the efficiency of instance creation, and solves the problem of high cold start overhead in the memory partition sandbox system under server unaware calculations.
Smart Images

Figure CN119149129A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud computing, and in particular to a function sandbox mechanism and a function cold start optimization mechanism in a server-unaware computing scenario. Background Art
[0002] Server-aware computing is an emerging cloud computing service model. Users do not need to care about the specific underlying infrastructure and do not need to pay additional learning costs to have an agile and efficient cloud business development and deployment experience, allowing users to focus on their own business innovation. In server-aware computing systems, the sandbox mechanism is a key security measure that can isolate the execution environment and ensure that the code runs in a controlled and secure environment. The sandbox mechanism can resist various potential security threats, such as cross-function data leakage and untrusted code execution. When the server-aware computing platform processes an external function request, if the function instance corresponding to the request does not exist at this time, a cold start of the function instance is required. At this time, the server-aware computing platform needs to create a function instance in real time, complete sandbox creation and application code loading, and then continue to execute the application logic to process the function call request. Compared with the case where the function instance exists when the request arrives, the request processing process of the function in the cold start case involves an additional sandbox creation process, which has a higher call latency.
[0003] For example, the existing invention patent application document "A Customizable APP Fusion Method Based on Remote Loading" with publication number CN115987959A, the existing method includes: building an APP fusion architecture, dynamically introducing APP sub-applications based on remote loading through the APP main application in the APP fusion architecture for APP fusion, wherein the APP sub-application is configured according to customization by the APP main application, the APP sub-application is loaded according to the configuration fusion, and the APP sub-application is rendered to provide data and event support for the APP sub-application to meet the communication needs between the APP sub-applications; and the APP main application uses the webcomponent container combined with the webview sandbox to isolate the loaded APP sub-application. However, the aforementioned existing sandbox isolation mechanism is mainly based on the container or virtual machine isolation mechanism, which is based on the process isolation mechanism provided by the operating system and has a large isolation overhead. The process involves more system resources, requires more initialization steps when creating, and different instances are independent of each other, and instances cannot be shared to reduce cold start delays. Another example is the existing invention patent application document "eBPF memory isolation method and system based on kernel-mode memory isolation hardware characteristics" with publication number CN116127445A. The existing method includes: step S1: calling an auxiliary function; step S2: the springboard function checks whether the parameters of the auxiliary function call are legal; if the check fails, error handling will be performed and the execution of the entire eBPF program will be terminated; if the check passes, step S3 will be entered; step S3: update PKRS to temporarily exit the sandbox; step S4: synchronize the shadow object back to the kernel object; step S5: call the real auxiliary function; step S6: synchronize the kernel object back to the shadow object; step S7: update the value of PKRS to re-enter the sandbox; step S8: end the call to the auxiliary function. However, the aforementioned sandbox system based on the memory partition isolation mechanism uses the user-mode memory isolation mechanism to implement memory isolation. There is no need to involve the state switching between the kernel and the user mode in the sandbox scheduling switching and sandbox memory isolation setting stages, which can provide more efficient isolation performance; and multiple sandbox instances safely share process instances, with fewer initialization steps and lower cold start overhead. Therefore, exploring a memory partition sandbox mechanism with low cold start latency plays an important role in helping cloud vendors improve the quality of server-aware computing services.
[0004] The existing memory partition sandbox mechanism can be divided into two categories according to the isolation level provided: weak isolation sandbox mechanism and strong isolation sandbox mechanism. For the weak isolation sandbox mechanism, since it does not isolate application system resources, its cold start delay is low and its memory overhead is low, but the isolation security provided is poor; for the strong isolation sandbox mechanism, it provides additional system resource isolation through the library operating system mechanism, and has better security. However, since it introduces an additional library operating system mechanism, it introduces additional initialization steps in the instance startup process, which increases the cold start delay.
[0005] The existing technology has technical problems such as high cold startup delay and low instance creation efficiency of the memory partition sandbox system in specific scenarios. Summary of the invention
[0006] The technical problem to be solved by the present invention is: how to solve the technical problems of high cold startup delay and low instance creation efficiency of the memory partition sandbox system in specific scenarios in the prior art.
[0007] The present invention adopts the following technical solutions to solve the above technical problems: a sandbox rapid creation method for server-unaware computing scenarios includes:
[0008] S1. For the server-unaware computing scenario, a memory partition sandbox rapid creation mechanism is constructed and utilized to handle the high cold start delay of the memory partition sandbox system in this scenario. In the CAP-VM memory partition sandbox system, a template instance cache pool component and a Supervisor component are added for the sandbox cold start operation. The cache pool component is used to maintain the template instance corresponding to the function, so that the template instance corresponding to the function completes the sandbox fork operation. The Supervisor component is used to modify the sandbox runtime and the CheriBSD operating system kernel data to implement the sandbox fork primitive.
[0009] S2. Obtain and use the similarity information of the application initialization process, use offline pre-initialized instances for the memory partition sandbox scenario, and reuse the pre-initialized instance state during online calls for instance creation operations;
[0010] S3. Utilize the integrated operating system kernel and sandbox runtime to tune the instance creation operation of the sandbox, set the sandbox fork primitive, and use the sandbox fork primitive to create a new instance based on the existing instance.
[0011] The present invention proposes a memory partition sandbox fast creation mechanism for server-unaware computing scenarios. By providing a sandbox fork primitive, the pre-initialized instance state is reused, thereby skipping the sandbox instance cold start process, reducing the sandbox cold start delay, and solving the high cold start overhead problem of the memory partition sandbox system under server-unaware computing.
[0012] The present invention utilizes the similarity of application initialization process, uses offline pre-initialized instances for memory partition sandbox scenarios, and reuses the pre-initialized instance state during online calls to skip the instance initialization process and speed up instance creation.
[0013] In a more specific technical solution, S1 includes:
[0014] S11. The sandbox system performs a pre-maintenance operation on the template instance corresponding to the function, and performs a new instance creation operation based on the template instance corresponding to the function through the sandbox fork primitive.
[0015] S12. When the preset function is deployed to the system, a sandbox fork cold start optimization operation is performed according to the parameter configuration information and the template instance corresponding to the function;
[0016] S13. When a function request arrives, first check whether there is a template instance corresponding to the function in the template instance cache pool;
[0017] S14. If yes, create a corresponding new instance through the sandbox fork primitive to complete the function request;
[0018] S15. If not, perform an instance cold start operation to trigger offline creation of a template instance, add the offline creation module instance to the template instance cache pool, so that when the current function is called, cold start acceleration is performed by forking the template instance;
[0019] S16. Design the fork mechanism in the sandbox fork primitive according to the resource type, use the Supervisor component, and establish a debugging relationship for the sandbox runtime process through the ptrace system call operation to monitor and adjust the sandbox runtime process status;
[0020] S17. Using the sandbox file resource namespace mechanism, virtualize the system file descriptor resources and perform status configuration on the file resources in the sandbox fork operation.
[0021] The present invention utilizes the integration of the operating system kernel and the sandbox runtime to speed up the sandbox creation operation, and designs a sandbox fork primitive, through which a new instance can be quickly created based on an existing sandbox instance.
[0022] In a more specific technical solution, in S16, a call parameter combination of the ptrace system is used to adjust the process state during the sandbox runtime, implement the sandbox instance thread resource interruption mechanism and status acquisition mechanism, and expose the sandbox instance thread resource interruption mechanism and status acquisition mechanism to the sandbox runtime through inter-process pipe communication.
[0023] In a more specific technical solution, the fork mechanism in S16 includes: a fork mechanism for thread resources, a fork mechanism for memory resources, and a fork mechanism for file resources.
[0024] In a more specific technical solution, in the thread resource fork mechanism, a Supervisor component is designed and used to change the sandbox thread state in the runtime.
[0025] In a more specific technical solution, the thread resource fork mechanism also includes: a thread interruption mechanism and a thread replication mechanism.
[0026] In a more specific technical solution, in S16, in the memory resource fork mechanism, a memory resource operating system partition is designed to call a pfork mechanism, and the parameters received by the memory resource operating system partition calling the pfork mechanism include: the starting address template of the template instance memory partition, the starting address addr of the pre-created new instance memory partition, and the memory partition length len.
[0027] The present invention designs a memory partition sandbox fork mechanism and implements a sandbox system Bootless-tfork based on the existing memory partition system CAP-VM. The design idea of the system is to efficiently reuse the offline pre-initial instance state through the sandbox fork primitive to complete the instance initialization process, thereby skipping the instance initialization phase, accelerating instance creation, and reducing function cold start delay.
[0028] In a more specific technical solution, in S16, in the file resource fork mechanism, during the process fork system call, a new process instance is generated through fork to hold a copy of the original process file descriptor to access the files opened by the original process.
[0029] In a more specific technical solution, the file resource fork mechanism also includes: a sandbox file resource namespace mechanism and host file resource related processing.
[0030] In a more specific technical solution, the sandbox rapid creation system for server-unaware computing scenarios includes:
[0031] The high cold start delay tuning module is used to build and use the memory partition sandbox rapid creation mechanism for the server non-aware computing scenario to handle the high cold start delay of the memory partition sandbox system in this scenario. In the CAP-VM memory partition sandbox system, a template instance cache pool component and a Supervisor component are added for the sandbox cold start operation. The cache pool component is used to maintain the function corresponding to the template instance so that the function corresponding to the template instance completes the sandbox fork operation. The Supervisor component is used to modify the sandbox runtime and the CheriBSD operating system kernel data to implement the sandbox fork primitive.
[0032] The online call processing module is used to obtain and use the similarity information of the application initialization process. For the memory partition sandbox scenario, the offline pre-initialized instance is used to reuse the pre-initialized instance state according to the online call for the instance creation operation. The online call processing module is connected to the high cold start delay tuning module;
[0033] The new instance creation module is used to utilize the integrated operating system kernel and sandbox runtime to tune the instance creation operation of the sandbox, set the sandbox fork primitive, and create a new instance based on the existing instance through the sandbox fork primitive. The new instance creation module is connected to the online call processing module.
[0034] The present invention proposes a memory partition sandbox fast creation mechanism for server-unaware computing scenarios. By providing a sandbox fork primitive, the pre-initialized instance state is reused, thereby skipping the sandbox instance cold start process, reducing the sandbox cold start delay, and solving the high cold start overhead problem of the memory partition sandbox system under server-unaware computing.
[0035] The present invention utilizes the similarity of application initialization process, uses offline pre-initialized instances for memory partition sandbox scenarios, and reuses the pre-initialized instance state during online calls to skip the instance initialization process and speed up instance creation.
[0036] The present invention utilizes the integration of the operating system kernel and the sandbox runtime to speed up the sandbox creation operation, and designs a sandbox fork primitive, through which a new instance can be quickly created based on an existing sandbox instance.
[0037] The present invention designs a memory partition sandbox fork mechanism and implements a sandbox system Bootless-tfork based on the existing memory partition system CAP-VM. The design idea of the system is to efficiently reuse the offline pre-initial instance state through the sandbox fork primitive to complete the instance initialization process, thereby skipping the instance initialization phase, accelerating instance creation, and reducing function cold start delay.
[0038] The present invention solves the technical problems of high cold startup delay and low instance creation efficiency of a memory partition sandbox system in a specific scenario in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of basic steps of a method for quickly creating a sandbox for server-unaware computing scenarios according to Embodiment 1 of the present invention;
[0040] Figure 2 A schematic diagram of data flow processing of a sandbox rapid creation system for server-unaware computing scenarios according to Embodiment 1 of the present invention;
[0041] Figure 3 This is a schematic diagram of data flow processing of a sandbox thread interruption mechanism according to Embodiment 1 of the present invention;
[0042] Figure 4 This is a schematic diagram of data flow processing of a sandbox thread state extraction mechanism according to Embodiment 1 of the present invention;
[0043] Figure 5This is a semantic diagram of the pfork system call in Example 1 of the present invention;
[0044] Figure 6 This is a schematic diagram of the file resource fork mechanism of Example 1 of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] Example 1
[0047] like Figure 1 As shown, the sandbox rapid creation method for server-unaware computing scenarios provided by the present invention includes:
[0048] S1. Aiming at the server-unaware computing scenario, we build and use the memory partition sandbox rapid creation mechanism to handle the high cold startup delay of the memory partition sandbox system in this scenario;
[0049] like Figure 2 As shown, in the overall architecture of the sandbox rapid creation system for server-unaware computing scenarios of this embodiment, on the basis of the original CAP-VM memory partition sandbox system implementation, a template instance cache pool component and a Supervisor component are added to accelerate the sandbox cold start process. The cache pool component is used to maintain the template instance corresponding to the function, ensuring that the corresponding template instance exists so that the sandbox fork operation can be completed; the sandbox fork primitive is implemented by adding the Supervisor component and modifying the sandbox runtime and the CheriBSD operating system kernel. In the sandbox rapid creation system for server-unaware computing scenarios, the sandbox system needs to maintain the template instance of the corresponding function instance in advance. The template instance refers to the sandbox instance that has completed the initialization process in advance and loaded into the memory. The sandbox fork primitive can create a new instance based on the template instance. In this embodiment, the sandbox fork primitive is similar to the existing process fork system call. Through the fork primitive, a new instance consistent with the current instance state can be created, including the thread, address space, file and other system resource states. The state is consistent with the template instance, and the new instance and the original instance can run independently and hold different resource copies.
[0050] In this embodiment, when a function is deployed to the system, the sandbox fork cold start optimization mentioned in the present invention can be enabled by configuring parameters to save a template instance for the function; when a function request arrives, the system first checks whether there is a template instance of the corresponding function in the template instance cache pool. If so, the corresponding new instance is created through the sandbox fork primitive to complete the function request; if not, a complete instance cold start process is performed. In addition, while completing the above-mentioned cold start, it will also trigger the operation of creating a template instance offline and adding it to the cache pool, so that when the function is called later, the cold start acceleration can be performed by forking the template instance. The design of the fork primitive can be based on different types of resources to be processed, including but not limited to: a fork mechanism for thread resources, a fork mechanism for memory resources, and a fork mechanism for file resources.
[0051] In the thread resource fork mechanism of this embodiment, an additional Supervisor component is designed, and the Supervisor component is used to change the sandbox thread state during runtime. The operations in the thread resource fork mechanism include but are not limited to: thread interruption and thread replication. In this embodiment, the thread interruption mechanism occurs before the actual fork operation of the sandbox. Interrupting the thread in the sandbox can put the sandbox instance in a state that meets a certain consistency, and can continue to execute in the subsequent new instance according to this state. In this embodiment, the sandbox thread resource replication mechanism includes but is not limited to: obtaining the thread resource state of the existing sandbox instance, and creating a thread object in the new sandbox instance with a state consistent with the existing template instance.
[0052] like Figure 3 As shown, in the sandbox thread fork mechanism of this embodiment, first, when the sandbox is running, a thread interrupt request is sent to the Supervisor component through a shared pipe, and the request content includes the thread instance ID contained in the sandbox instance. After receiving the thread interrupt request, the Supervisor component specifies the PTRACE_ATTACH parameter through the ptrace system call to initiate an interrupt request to the CheriBSD kernel. After receiving the system call, the CheriBSD kernel sends a SIGSTOP signal to the specified thread according to the internal implementation to interrupt it. After sending the signal to the specified thread, the system call returns. After completing the system call, the Supervisor component completes the thread interrupt request processing and sends the request back to the sandbox snapshot module.
[0053] like Figure 4 As shown, in this embodiment, after the sandbox thread interruption is completed, the thread fork mechanism needs to extract the sandbox thread state information and construct a new instance thread resource based on the information. Figure 4This paper shows how to implement the thread information extraction mechanism in the Botless-tfork system. Similar to the thread interrupt mechanism, this system uses the ptrace system call mechanism of the operating system and is completed through the collaboration of the Supervisor and the sandbox snapshot module. The ptrace system call parameter with the parameter PTRACE_GETREGS can be used to obtain the register value of the specified thread when the traced process is suspended. The overall process of this part is as follows: During the sandbox thread replication process, after the thread is interrupted in the previous step, the snapshot module can send a request to the Supervisor again to obtain the thread register status. After receiving the request, the Supervisor component obtains the current register status of the specified thread one by one through the ptrace PTRACE_GETREGS parameter. After receiving the system call request, the CheriBSD kernel reads the user-mode register status of the corresponding thread in the kernel and writes it back to the memory area specified by the user-mode Supervisor. Finally, the Superivsor component obtains the register status of the specified thread after the system call returns, and writes the response back to the snapshot module through the pipeline to complete the extraction of thread resource metadata.
[0054] In this embodiment, a newly added Supervisor component is used, which establishes a debugging relationship with the sandbox runtime process through the ptrace system call, and can monitor and change the state of the sandbox runtime process. In this embodiment, the parameter combination of the ptrace system call is used to complete the change of the state in the sandbox runtime process, complete the interruption and state acquisition mechanism of the sandbox instance thread resources, and expose it to the sandbox runtime through the inter-process pipeline communication. In the sandbox fork operation of this embodiment, the sandbox runtime calls the relevant services provided by the Supervisor component through the pipeline to complete the thread resource fork operation.
[0055] In the implementation process of the memory resource fork mechanism of this embodiment, a new memory resource operating system call pfork is designed, which means partition fork mechanism. The system call receives three parameters, namely: template specifies the starting address of the template instance memory partition, addr parameter specifies the starting address of the new instance memory partition to be created, and len parameter specifies the length of the memory partition. Through the above three parameters passed in, the pfork system call can identify the memory partition corresponding to the template instance and the memory partition of the new instance created by the sandbox fork operation, and complete the fork operation of the memory partition. In this embodiment, the introduction of the pfork system call does not require the introduction of too much support for sandbox objects in the kernel, but only requires the reuse of existing processes and memory mapping objects, and the sandbox mechanism is only involved when the sandbox fork operation is performed, so as to avoid the deep coupling of the sandbox mechanism with the operating system kernel and increase the sandbox overhead.
[0056] like Figure 5 As shown, in this embodiment, in the semantics of the pfork system call, after the pfork system call is executed, the address space of the process will undergo the following changes: a new memory mapping is set in the memory partition of the new instance, where the number of memory mappings is consistent with that in the template instance partition. In addition, the memory mapping in the new instance is consistent with the memory mapping state of the corresponding offset position in the template instance, that is, it has the same protection permissions and memory content. Figure 5 Memory segments are identified by the same color.
[0057] In the file resource fork mechanism of this embodiment, in the process fork system call, the new process instance generated by fork holds a copy of the original process file descriptor, and can access the files opened by the original process through these file descriptors. After the sandbox fork operation is completed, the file resource settings held by the sandbox also have a similar effect.
[0058] In this embodiment, the implementation of the pfork system call reuses the memory mapping flags involved in the process fork system call and the kernel's page protection error processing function. When pfork is called, it first obtains the memory partition range of the template instance and the new instance, and checks whether the memory partition of the new instance is valid and whether there is already a mapping in the partition. If there is a mapping, the mapping in the partition is first deleted. Then, the pfork system call scans all memory mappings in the template instance and processes them separately according to the mapping type: for shared mappings and read-only private mappings, a corresponding memory mapping is created on the new memory partition, the memory mapping object is set to the memory object corresponding to the original mapping, and the current reference count of the memory object is updated; for writable private mappings, the pfork system call first updates the page table corresponding to the template memory partition to remove the write permission, and sets the MAP_ENTRY_COW flag, and then creates a mapping at the specified location of the new memory partition similar to the above process, and updates the memory object reference count. After creating a corresponding mapping in the new partition for each mapping in the template partition, the pfork system call returns. After the pfork system call is completed, future page exceptions triggered by access to related pages will reuse the existing exception handling mechanism, and decide whether to perform a page copy operation by checking the MAP_ENTRY_COW flag, ultimately making the two memory partitions have the same initial state and can be changed independently.
[0059] like Figure 6 As shown, in this embodiment, the overall file resource fork mechanism can be divided into a sandbox file resource namespace mechanism and host file resource related processing.
[0060] In this embodiment, a sandbox file resource namespace mechanism is designed to virtualize the system file descriptor resources and complete the state configuration of the file resources in the sandbox fork operation. Under the action of the sandbox mechanism, all file operations applied in the sandbox must be completed by the sandbox runtime through the host call mechanism, and the sandbox runtime performs file operations on the system file descriptors implemented by the actual operating system. In this embodiment, the file resources referenced in the sandbox are mapped to different host file resources through the namespace mechanism, so that file descriptor sharing between different sandboxes can be achieved. In addition, the sandbox file resource namespace mechanism maintains the operation data of the sandbox instance for the file resources by hijacking the file IO operations in the sandbox, and the overall replication and sharing of the sandbox instance file resources can be completed by modifying the namespace mapping. At the same time, in order to avoid file resource operation conflicts, the file resource fork mechanism needs to limit the host file resources to read-only before different sandbox instances share file resources, so as to avoid exceptions caused by different sandbox instances performing write operations on shared files.
[0061] S2. Taking advantage of the similarity of the application initialization process, for the memory partition sandbox scenario, use offline pre-initialized instances and reuse the pre-initialized instance state during online calls to skip the instance initialization process and perform instance creation operations;
[0062] S3. Utilize the integration of the operating system kernel and the sandbox runtime to speed up the sandbox creation operation, design the sandbox fork primitive, and use the sandbox fork primitive to create a new instance based on the existing sandbox instance.
[0063] In summary, the present invention proposes a memory partition sandbox fast creation mechanism for server-unaware computing scenarios. It reuses the pre-initialized instance state by providing a sandbox fork primitive, thereby skipping the sandbox instance cold start process, reducing the sandbox cold start delay, and solving the high cold start overhead problem of the memory partition sandbox system under server-unaware computing.
[0064] The present invention utilizes the similarity of application initialization process, uses offline pre-initialized instances for memory partition sandbox scenarios, and reuses the pre-initialized instance state during online calls to skip the instance initialization process and speed up instance creation.
[0065] The present invention utilizes the integration of the operating system kernel and the sandbox runtime to speed up the sandbox creation operation, and designs a sandbox fork primitive, through which a new instance can be quickly created based on an existing sandbox instance.
[0066] The present invention designs a memory partition sandbox fork mechanism and implements a sandbox system Bootless-tfork based on the existing memory partition system CAP-VM. The design idea of the system is to efficiently reuse the offline pre-initial instance state through the sandbox fork primitive to complete the instance initialization process, thereby skipping the instance initialization phase, accelerating instance creation, and reducing function cold start delay.
[0067] The present invention solves the technical problems of high cold startup delay and low instance creation efficiency of a memory partition sandbox system in a specific scenario in the prior art.
[0068] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A sandbox rapid creation method for server-unaware computing scenarios, characterized in that: The method comprises: S1. For the server-unaware computing scenario, a memory partition sandbox rapid creation mechanism is constructed and utilized to handle the high cold start delay of the memory partition sandbox system in this scenario. In the CAP-VM memory partition sandbox system, a template instance cache pool component and a Supervisor component are added for the sandbox cold start operation. The cache pool component is used to maintain the template instance corresponding to the function, so that the template instance corresponding to the function completes the sandbox fork operation. The Supervisor component is used to modify the sandbox runtime and the CheriBSD operating system kernel data to implement the sandbox fork primitive. S2. Obtain and use the similarity information of the application initialization process, use offline pre-initialized instances for the memory partition sandbox scenario, and reuse the pre-initialized instance state during online calls for instance creation operations; S3. When integrating the operating system kernel and the sandbox runtime, the instance creation operation of the sandbox is optimized, the sandbox fork primitive is set, and a new instance is created according to the existing instance through the sandbox fork primitive.
2. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 1 is characterized in that: The S1 includes: S11. Enable the sandbox system to perform a pre-maintenance operation on the template instance corresponding to the function, and perform a new instance creation operation based on the template instance corresponding to the function through the sandbox fork primitive. S12. When the preset function is deployed to the system, a sandbox fork cold start optimization operation is performed according to the parameter configuration information and the template instance corresponding to the function; S13. When a function request arrives, first check whether there is a template instance corresponding to the function in the template instance cache pool; S14. If yes, create a corresponding new instance through the sandbox fork primitive to complete the function request; S15. If not, perform an instance cold start operation to trigger offline creation of a template instance, add the offline creation module instance to the template instance cache pool, so that when the current function is called, cold start acceleration is performed by forking the template instance; S16. Design a fork mechanism in the sandbox fork primitive according to the resource type, use the Supervisor component to establish a debugging relationship for the sandbox runtime process through the ptrace system call operation, and monitor and adjust the sandbox runtime process state; S17. Utilize the sandbox file resource namespace mechanism to virtualize system file descriptor resources and perform status configuration on file resources in the sandbox fork operation.
3. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 2 is characterized in that: In S16, the calling parameter combination of the ptrace system is used to adjust the process state of the sandbox runtime, implement the sandbox instance thread resource interruption mechanism and the state acquisition mechanism, and expose the sandbox instance thread resource interruption mechanism and the state acquisition mechanism to the sandbox runtime through inter-process pipe communication.
4. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 2 is characterized in that: The fork mechanism in S16 includes: a fork mechanism for thread resources, a fork mechanism for memory resources, and a fork mechanism for file resources.
5. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 4 is characterized in that: In the thread resource fork mechanism, the Supervisor component is designed and utilized to change the sandbox thread state during runtime.
6. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 4 is characterized in that: The thread resource fork mechanism also includes: a thread interruption mechanism and a thread replication mechanism.
7. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 2, characterized in that: In S16, in the memory resource fork mechanism, a memory resource operating system partition is designed to call a pfork mechanism, and the parameters received by the memory resource operating system partition calling the pfork mechanism include: the template instance memory partition starting address template, the pre-created new instance memory partition starting address addr, and the memory partition length len.
8. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 2, characterized in that: In S16, in the file resource fork mechanism, during the process fork system call, a new process instance is generated through fork to hold a copy of the original process file descriptor to access the file opened by the original process.
9. The method for quickly creating a sandbox for server-unaware computing scenarios according to claim 8, characterized in that: The file resource fork mechanism also includes: a sandbox file resource namespace mechanism and host file resource related processing.
10. A sandbox rapid creation system for server-aware computing scenarios, characterized by: The system comprises: The high cold start delay tuning module is used to build and use the memory partition sandbox rapid creation mechanism for the server non-perceptual computing scenario to handle the high cold start delay of the memory partition sandbox system in this scenario. In the CAP-VM memory partition sandbox system, a template instance cache pool component and a Supervisor component are added for the sandbox cold start operation. The cache pool component is used to maintain the function corresponding to the template instance so that the function corresponding to the template instance completes the sandbox fork operation. The Supervisor component is used to modify the sandbox runtime and the CheriBSD operating system kernel data to implement the sandbox fork primitive. An online call processing module is used to obtain and use the similarity information of the application initialization process. For the memory partition sandbox scenario, an offline pre-initialized instance is used to reuse the pre-initialized instance state according to the online call for the instance creation operation. The online call processing module is connected to the high cold start delay tuning module; A new instance creation module is used to utilize the integrated operating system kernel and sandbox runtime to tune the instance creation operation of the sandbox, set the sandbox fork primitive, and create a new instance based on the existing instance through the sandbox fork primitive. The new instance creation module is connected to the online call processing module.
Citation Information
Patent Citations
Customizable APP fusion method based on remote loading
CN115987959A
EBPF memory isolation method and system based on kernel mode memory isolation hardware characteristics
CN116127445A
Isolation sandbox loading method
CN110968361A
Function calculation cold start acceleration method based on lightweight security container
CN113672343A
Container creation processing method and system, electronic equipment and readable storage medium
CN116126471A
