Instance startup acceleration method and related apparatus

By obtaining and utilizing instance snapshots and templates, and directly filling data in the memory to skip initialization, the problem of microservice startup delay is solved, and the instance startup speed and elastic scalability of cloud deployment are improved.

WO2024179400A1PCT designated stage expired Publication Date: 2024-09-06HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/078528
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-02-21
Filing Date
2024-02-26
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

When microservices are deployed on the cloud, the instance startup delay is long, which limits elastic scaling capabilities. Especially for Java microservices, the startup delay is too long due to the complex framework and class loading process.

Method used

By obtaining the instance snapshot and instance template of the started instance, recording and describing the data storage method of the instance during operation, it can directly fill the required data in the memory to skip the initialization process and achieve fast startup.

Benefits of technology

It significantly reduces instance startup time, avoids cumbersome initialization processes, and improves the elastic scalability of microservices deployed on the cloud.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024078528_06092024_PF_FP
    Figure CN2024078528_06092024_PF_FP
Patent Text Reader

Abstract

An instance startup acceleration method, which is applied to startup acceleration of instances such as processes, threads, or hyper-threads. In the method, by means of acquiring an instance snapshot created on the basis of a started instance and an instance template created on the basis of the instance snapshot, it is possible to acquire data generated by the started instance in an operation period and learn a storage mode of the foregoing portion of data in a memory. Then, with reference to a storage mode indicated by the instance template, the foregoing portion of data indicated by the instance snapshot is filled into a corresponding position of a current node memory, thereby implementing resumption of an operation instance on the basis of the data stored in the memory, avoiding instance initialization processes (namely code compiling and executing processes) having long execution latencies, and increasing the instance startup speed.
Need to check novelty before this filing date? Find Prior Art

Description

A startup acceleration method and related device of an example

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 28, 2023, with application number 202310224118.1 and invention name “A startup acceleration method and related device for an example”, and the Chinese patent application filed with the State Intellectual Property Office on February 21, 2024, with application number 202410194686.6 and invention name “A startup acceleration method and related device for an example”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computer technology, and more particularly to a startup acceleration method and related devices. Background Art

[0003] Microservices is an architectural and organizational approach to software development that enables software to be composed of multiple small, independent services, each of which can be managed by a small, independent team. Microservices architecture can make applications easier to scale and faster to develop, thereby accelerating innovation and reducing time to market for new application features.

[0004] Currently, microservices are deployed using multiple instances to support high-concurrency user access. Furthermore, services within these microservice architectures typically run on the cloud to leverage the dynamic scalability of cloud resources.

[0005] However, for most microservices, such as Java microservices, since microservices themselves often use a large number of components and the startup process is relatively complex, the startup delay of the microservice instances is long, which greatly limits the elastic scaling of microservices when deployed on the cloud.

[0006] Summary of the Invention

[0007] This application provides a method for accelerating the startup of an instance, which can speed up the startup process of the instance and reduce the startup delay of the instance.

[0008] The first aspect of the present application provides a method for accelerating the startup of an instance, which can be applied to accelerating the startup of instances such as processes, threads or hyperthreading. In this method, an instance snapshot and an instance template are first obtained. The instance snapshot is obtained based on the started first instance, and the instance snapshot is used to indicate the data generated by the first instance during operation (including all data generated by the first instance during the startup phase). Specifically, the instance snapshot records the runtime memory state of the first instance (that is, the data corresponding to the first instance in the memory under a certain instantaneous state), that is, the instance snapshot records the data on which the running of the first instance depends. The instance template can be created based on the instance snapshot to indicate how the data is stored in the memory during the startup of the first instance. That is, the instance template describes how the data generated by the first instance during operation is specifically stored in the memory.

[0009] Then, based on the instance template, the data indicated in the instance snapshot is stored in the first memory, so that the memory is filled with the data required during the instance startup process.

[0010] Finally, after the data indicated by the instance snapshot is stored in the first memory in a specified manner, it means that all data required to start the second instance is ready, so the second instance can be resumed based on the data stored in the first memory.

[0011] In this solution, by obtaining the instance snapshot created based on the started instance and the instance template created based on the instance snapshot, the data generated by the started instance during operation can be obtained and the storage method of this data in the memory can be known. Then, referring to the storage method indicated by the instance template, the data indicated by the instance snapshot is filled into the corresponding position of the current node memory, so as to restore the running instance based on the data stored in the memory, avoid the instance initialization process with a long execution delay (that is, the process of code compilation and execution), and improve the speed of instance startup.

[0012] In one possible implementation, the first memory is a shared memory, and different instances on the same electronic device can share the data in the first memory, so the data stored in the first memory can be used to restore one or more instances of the same type. Here, multiple instances of the same type refer to instances restored based on the same data. For example, in the case where the instance is a process, multiple processes of the same type may refer to multiple different processes pulled up based on the same executable code in the first memory. In this way, when multiple instances of the same type are started on the same electronic device, the shared data in the shared memory can be used to quickly start the instance, avoiding the process of storing the data indicated in the instance snapshot into the memory again, thereby increasing the speed of instance startup.

[0013] In one possible implementation, the aforementioned instance template is further used to indicate the running state of the first instance at the time the instance snapshot was created, that is, the specific state the first instance was running in when the instance snapshot was created. Thus, when resuming the second instance based on the data stored in the first memory, the instruction at the first address in the first memory can be jumped to and executed based on the running state indicated by the instance template. The instruction at the first address corresponds to the data stored in the first memory, and the instruction at the first address corresponds to the instruction executed by the first instance while it was running. Thus, when executing the instruction at the first address in the first memory, the running state of the second instance is the same as the running state of the first instance at the time the instance snapshot was created. For example, in actual application, based on the address space pointer of the first instance indicated by the second type of data in the instance template, the assembler's "jump" instruction is called to jump to the state the first instance was in at the time the instance snapshot was created, thereby resuming the second instance.

[0014] In this solution, by indicating the running status of the first instance at the creation time node of the instance snapshot in the instance template, it is possible to jump back to the corresponding instance running status after restoring the data required for instance operation to the first memory to achieve the recovery of the second instance, thereby eliminating the need to perform the tedious process required for the instance during initial startup (such as the business initialization phase introduced above), effectively improving the startup speed of the instance.

[0015] In one possible implementation, the instance template is specifically used to indicate the size of the memory area occupied by the data indicated in the instance snapshot, that is, the size of the memory area that the data generated by the first instance needs to occupy. Thus, when storing the data indicated in the instance snapshot in the first memory based on the instance template, the first area for storing data in the first memory can be determined based on the size of the memory area; and then the data indicated in the instance snapshot is stored in the first area of ​​the first memory. The size of the first area is consistent with the size of the memory area indicated in the instance template, that is, the first area is greater than or equal to the size of the memory area indicated in the instance template.

[0016] In this solution, by determining a memory area of ​​the required size in the first memory based on the instructions of the instance template to store the data indicated in the instance snapshot, it can ensure that the data required to run the second instance can be stored in a continuous memory area, avoiding memory pollution and affecting the normal operation of the second instance.

[0017] In one possible implementation, the instance template is also specifically used to indicate the data structure of the data indicated in the instance snapshot. In this way, when the data indicated in the instance snapshot is stored in the first memory based on the instance template, the instance snapshot can be first parsed based on the data structure indicated by the instance template to obtain the data indicated in the instance snapshot.

[0018] For example, when the instance snapshot is obtained by serializing data generated by the first instance, the instance snapshot can be deserialized based on the data structure indicated by the instance template, thereby restoring the data actually indicated in the instance snapshot.

[0019] In one possible implementation, the instance template is specifically used to indicate one or more of the following: the running status of the first instance at the creation time of the instance snapshot, the size of the memory area occupied by the data indicated in the instance snapshot, and the data structure of the data indicated in the instance snapshot.

[0020] In one possible implementation, the operating environment of the second instance is a virtual machine, a container, or a container group.

[0021] In one possible implementation, the second instance is configured to access a Backend as a Service (BaaS) through a proxy component. The BaaS provides data services for the second instance, such as cloud data / file storage, account management, push notifications, and social media integration. Furthermore, during the recovery process of the second instance, the proxy component maintains a connection with the BaaS. The proxy component is pre-established and is configured to maintain a connection with the BaaS, allowing it to proxy the second instance's access to the BaaS at any time.

[0022] In one possible implementation, the connection between the proxy component and the BaaS may be obtained. After the second instance resumes operation, the connection between the proxy component and the BaaS is returned to the second instance, so that the second instance can access the BaaS by accessing the proxy component.

[0023] In this solution, a pre-established proxy component is used to maintain the connection with BaaS, and the proxy component is used to proxy the instance's access behavior to BaaS. This allows the instance to not need to re-establish a connection with BaaS during startup, reducing the time spent on establishing the connection and improving the startup speed of the instance.

[0024] In one possible implementation, the instance snapshot and instance template are obtained from the running node of the first instance via the network. That is, the running node of the first instance pre-creates the instance snapshot and instance template based on the running first instance, and then transmits the instance snapshot and instance template to the running node of the second instance, thereby resuming the operation of the second instance based on the instance snapshot and instance template.

[0025] In a possible implementation, the first instance and the second instance are processes, threads, or hyperthreads.

[0026] In one possible implementation, the first instance and the second instance are instances in a microservices architecture. In a microservices architecture, an application is composed of many loosely coupled and independently deployable smaller services, and the first instance and the second instance can be instances of one of these services, capable of implementing a set of independent features or functions.

[0027] A second aspect of the present application provides an instance startup acceleration device, including: an acquisition module, used to obtain an instance snapshot and an instance template, the instance snapshot is obtained based on a started first instance, the instance snapshot is used to indicate the data generated by the first instance during operation, and the instance template is used to indicate how the data is stored in the memory during the startup of the first instance; a processing module, used to store the data indicated in the instance snapshot in the first memory based on the instance template; the processing module is also used to resume the operation of the second instance based on the data stored in the first memory.

[0028] In a possible implementation, the first memory is a shared memory, and data stored in the first memory is used to restore one or more instances of the same type.

[0029] In one possible implementation, the instance template is also used to indicate the running status of the first instance at the creation time of the instance snapshot; the processing module is further used to: based on the running status indicated by the instance template, jump to the instruction in the first address of the first memory and execute the instruction, wherein, when executing the instruction, the running status of the second instance is the same as the running status of the first instance at the creation time of the instance snapshot.

[0030] In one possible implementation, the instance template is specifically used to indicate the size of the memory area occupied by the data indicated in the instance snapshot; the processing module is also used to: determine a first area in the first memory for storing data based on the size of the memory area; and store the data indicated in the instance snapshot in the first area in the first memory.

[0031] In a possible implementation, the instance template is further used to indicate the data structure of the data indicated in the instance snapshot; the processing module is further used to: parse the instance snapshot based on the data structure indicated by the instance template to obtain the data indicated in the instance snapshot.

[0032] In one possible implementation, the instance template is specifically used to indicate one or more of the following: the running status of the first instance at the creation time of the instance snapshot, the size of the memory area occupied by the data indicated in the instance snapshot, and the data structure of the data indicated in the instance snapshot.

[0033] In one possible implementation, the second instance is used to access the Backend as a Service (BaaS) through a proxy component, and the BaaS is used to provide data services for the operation of the second instance; during the process of resuming the operation of the second instance, the proxy component maintains a connection with the BaaS.

[0034] In a possible implementation, the acquisition module is further configured to acquire the connection between the proxy component and the BaaS; and the processing module is further configured to return the connection to the second instance after the second instance resumes operation.

[0035] In a possible implementation, the instance snapshot and the instance template are obtained from a running node of the first instance through a network.

[0036] In a possible implementation, the first instance and the second instance are processes, threads, or hyperthreads.

[0037] In one possible implementation, the first instance and the second instance are instances under a microservice architecture.

[0038] In a third aspect of the present application, a startup acceleration device of an example is provided, which includes: a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the startup acceleration device of the example executes a method as implemented in any one of the first aspect or the second aspect.

[0039] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer-readable storage medium is run on a computer, the computer executes a method as implemented in any one of the first and second aspects.

[0040] A fifth aspect of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute a method as implemented in any one of the first or second aspects.

[0041] In a sixth aspect, the present application provides a chip comprising one or more processors, wherein some or all of the processors are configured to read and execute a computer program stored in a memory to perform the method in any one of the implementations of the first or second aspect.

[0042] Optionally, the chip includes a memory, and the memory is connected to the processor via a circuit or wire. Optionally, the chip also includes a communication interface, and the processor is connected to the communication interface. The communication interface is used to receive data and / or information to be processed, and the processor obtains the data and / or information from the communication interface, processes the data and / or information, and outputs the processing results through the communication interface. The communication interface can be an input / output interface. The method provided in this application can be implemented by a single chip or by multiple chips working together.

[0043] Among them, the technical effects brought about by any design method in the second to sixth aspects can refer to the technical effects brought about by different implementation methods in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 is a schematic diagram of the startup delay of a Java microservice;

[0045] FIG2 is a schematic structural diagram of an electronic device 101 provided in an embodiment of the present application;

[0046] FIG3 is a flow chart of a startup acceleration method according to an embodiment of the present application;

[0047] FIG4 is a schematic diagram of a process flow for accelerating the startup of a process based on a process snapshot according to an embodiment of the present application;

[0048] FIG5 is a schematic diagram of a process of creating multiple processes on node 2 according to an embodiment of the present application;

[0049] FIG6 is a schematic diagram showing a comparison of processes for starting a process on different nodes according to an embodiment of the present application;

[0050] FIG7 is a schematic diagram showing a comparison of processes for starting a process in different ways according to an embodiment of the present application;

[0051] FIG8 is a schematic structural diagram of a starting acceleration device according to an embodiment of the present application;

[0052] FIG9 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application;

[0053] FIG10 is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0055] The terms "first," "second," "third," "fourth," and the like (if any) in the specification and claims of this application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0056] To facilitate understanding, some technical terms involved in the embodiments of this application are first introduced below.

[0057] (1) Microservices

[0058] Microservices is a software development technique and a variation of the service-oriented architecture (SOA) style. It advocates dividing a single application into a set of small services that coordinate and collaborate to deliver ultimate value to users. Each service runs in its own independent process, communicating with each other using lightweight communication mechanisms. Each service is built around a specific business need and can be independently deployed in production or production-like environments.

[0059] Simply put, microservices is a cloud-native architecture that enables a single application to be composed of many loosely coupled, independently deployable smaller components or services. This means breaking a monolithic application into smaller, independent services. A service typically implements a set of independent features or functions, including its own business logic and adapters. Microservices are interconnected by exposing APIs. These independent microservices do not need to be deployed on the same virtual machine, system, or application server.

[0060] (2)Java

[0061] Java is a programming language designed specifically for the distributed environment of the Internet. It has a look and feel similar to C++, but is easier to use and employs a thoroughly object-oriented approach to programming. Applications written in Java can run on a single computer or be distributed across a network of servers and clients.

[0062] Java microservices refer to microservices written in Java.

[0063] (3) Examples

[0064] An instance refers to an entity of an application during its operation. In this embodiment, an instance can be, for example, a process, a thread, or a hyperthread.

[0065] (4) Process

[0066] A process is a computer program's execution of a specific set of data. It is the basic unit of system resource allocation and the foundation of operating system architecture. In early process-oriented computer architectures, processes were the basic execution entity of programs; in modern thread-oriented computer architectures, processes are containers for threads. A program is a description of instructions, data, and their organization; a process is the entity of the program.

[0067] (5)Thread

[0068] A thread is the smallest unit of computation that an operating system can schedule. It's typically contained within a process and serves as the actual unit of operation within that process. A thread is a single, sequential flow of control within a process. Multiple threads can run concurrently within a process, each executing different tasks in parallel.

[0069] (6) Hyperthreading

[0070] Hyperthreading simulates the two logical cores within a multi-threaded processor as two physical chips, allowing a single processor to perform thread-level parallel computing and thus be compatible with multi-threaded operating systems and software. Simply put, hyperthreading refers to two logical threads being processed simultaneously by a single processor.

[0071] (7) Snapshot

[0072] A snapshot is a usable copy of a specified data set, which includes an image of the corresponding data at a certain point in time (the time when the copy starts). Specifically, a snapshot can be a copy or a replica of the data it represents.

[0073] (8) Instance snapshot

[0074] An instance snapshot is a snapshot of the instantaneous state of the contents of a launched instance. Specifically, it includes all data generated by the launched instance during its operation.

[0075] (9) Shared Memory

[0076] Shared memory refers to a large amount of memory that can be accessed by different central processing units (CPUs) in a multi-processor computer system.

[0077] (10) Copy-on-write (COW)

[0078] Copy-on-write is an optimization strategy in computer programming. The core idea is that if multiple callers simultaneously request the same resource (such as data stored in memory or on disk), they all obtain the same pointer to the same resource. Only when a caller attempts to modify the resource's contents does the system actually make a private copy for that caller, while the original resource remains unchanged for other callers. This process is transparent to other callers.

[0079] The main advantage of copy-on-write is that if the caller does not modify the resource, no private copy is created, so multiple callers can share the same resource when they are just reading it.

[0080] (11) Virtual Machine

[0081] A virtual machine is a highly isolated software container that runs its own operating system and applications as if it were a physical computer. A virtual machine behaves exactly like a physical computer and contains its own virtual CPU, internal memory, and network interface card. A virtual machine consists entirely of software and contains no hardware components.

[0082] (12)Container

[0083] A container is an independent runtime environment, similar to a virtual machine, that isolates applications and their dependencies, enabling efficient use of computer resources and improving energy efficiency and cost-effectiveness. The main differences between containers and virtual machines lie in the location of the virtualization layer and how operating system resources are used.

[0084] (13)Pod

[0085] A pod is essentially the smallest scheduling unit in Kubernetes. It's an environment that includes resources like containers, storage, and network ports. Generally speaking, a node is the actual host where a pod runs. A node can be a physical machine or a virtual machine. Multiple pods can run on a node, and each pod can contain multiple containers. Therefore, a pod is also called a container group.

[0086] Among them, Kubernetes is a containerized application used to manage multiple hosts in a cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and efficient.

[0087] (14) Backend as a Service (BaaS)

[0088] BaaS refers to edge services that integrate cloud backends for mobile app developers. Specifically, BaaS is a new type of cloud service designed to provide backend cloud services for applications, including cloud data / file storage, account management, push notifications, and social media integration.

[0089] (15) Remote Procedure Call (RPC)

[0090] RPC is a protocol for requesting services from remote computers over a network without requiring knowledge of the underlying network technology. Specifically, for Server A and Server B, an application deployed on Server A wants to call a function or method provided by the application on Server B. Because the two applications are not in the same memory space, direct calls cannot be made. Therefore, the call semantics and data must be expressed over the network. RPC provides a way to obtain services from remote servers over the network.

[0091] (16) Remote Direct Memory Access (RDMA)

[0092] RDMA technology was developed to address server-side data processing delays during network transmission. RDMA transfers data directly to a computer's storage area over the network, rapidly moving data from one system to a remote system's memory without impacting the operating system and requiring minimal computer processing power. It eliminates the overhead of external memory copies and context switches, freeing up memory bandwidth and CPU cycles for improved application performance.

[0093] (17)Data Structure

[0094] A data structure is how computers store and organize data. Specifically, a data structure refers to a collection of data elements that share one or more specific relationships. A carefully chosen data structure often results in higher operational or storage efficiency.

[0095] (18) Metadata

[0096] Metadata, also known as intermediary data or relay data, is data about data. It mainly describes the attributes of data and is used to support functions such as indicating storage location, historical data, resource search, and file records.

[0097] Currently, for most microservices, such as Java microservices, since microservices themselves often use a large number of components and the startup process is relatively complex, the startup delay of the microservice instances is long, which greatly limits the elastic scaling of microservices when deployed on the cloud.

[0098] For example, please refer to Figure 1, which shows a schematic diagram of the startup latency of a Java microservice. By breaking down the startup latency of a Java microservice, as shown in Figure 1, we can understand the distribution of the time consumed by each stage of the Java microservice startup process. Specifically, in the case of a cold start, the startup latency of a Java microservice is mainly divided into two parts: one part is the platform-side time consumption, and the other part is the service-side time consumption.

[0099] The platform's time consumption primarily includes preparations such as creating the execution environment (such as starting the container) and initializing the execution environment (such as downloading and deploying the code package). This phase typically responds within seconds and accounts for a very small portion of the overall cold start time, typically less than 5%. Generally speaking, the platform also supports optimization methods to further reduce this time consumption to milliseconds.

[0100] The service-side time consumption primarily involves microservice framework startup and business initialization (such as business data initialization). This phase typically takes a long time. In the example shown in Figure 1, microservice framework startup accounts for approximately 30% of the time, while business initialization accounts for approximately 65%. Therefore, it can be inferred that the actions performed during this phase are the core cause of slow Java microservice startup.

[0101] Taking Java microservices as an example, the main reasons for the slow startup of Java microservices on the service side include the following two points: 1. The Java microservice framework is complex. As an enterprise-level framework, Java microservices have a large amount of configurable and initialization logic to support a wide range of application requirements, and use complex design patterns to support this flexibility. In many cases, the number of class files that a typical Java microservice depends on can be very large. 2. In addition, when Java microservices perform class loading during startup, the overhead of searching and verifying classes increases with application complexity. At the same time, when a Java microservice is first started, Just-in-Time (JIT) optimization is often not triggered, and hot bytecode still needs to be interpreted and executed. Therefore, in most cases, the interpreted execution remains, which affects the startup speed of the Java microservice.

[0102] In general, when Java microservices are latency-sensitive microservices deployed on the cloud, when the Java microservices are cold-started under burst traffic, the user experience may be degraded due to the long startup delay.

[0103] In view of this, an embodiment of the present application provides a method for accelerating the startup of an instance. By obtaining an instance snapshot created based on the started instance and an instance template created based on the instance snapshot, the data generated by the started instance during operation can be obtained and the storage method of this data in the memory can be known. Then, the data indicated by the instance snapshot is filled into the corresponding position of the current node memory with reference to the storage method indicated by the instance template, so as to realize the recovery of the running instance based on the data stored in the memory, avoid the instance initialization process with a long execution delay (that is, the process of code compilation and execution), and improve the speed of instance startup.

[0104] The startup acceleration method of the example provided in the embodiment of the present application can be applied to electronic devices. Exemplarily, the electronic device can be, for example, a server, a smart phone, a personal computer (PC), a laptop, a tablet computer, a smart TV, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless communication device in industrial control (industrial control), a wireless communication device in a smart grid (smart grid), a wireless communication device in transportation safety (transportation safety), a wireless communication device in a smart city (smart city), a wireless communication device in a smart home (smart home), a router, a switch, a firewall, a hub and other physical devices. In addition, the electronic device can also be a virtualized device such as a virtual machine.

[0105] Please refer to Figure 2, which is a schematic diagram of the structure of an electronic device 101 provided in an embodiment of the present application. As shown in Figure 2, electronic device 101 includes a processor 103, which is coupled to a system bus 105. Processor 103 can be one or more processors, each of which can include one or more processor cores. A display adapter (video adapter) 107 can drive a display 109, which is coupled to system bus 105. System bus 105 is coupled to an input / output (I / O) bus via a bus bridge 111. An I / O interface 115 is coupled to the I / O bus. The I / O interface 115 communicates with various I / O devices, such as an input device 117 (e.g., a touch screen), an external memory 121 (e.g., a hard disk, floppy disk, optical disk, or USB flash drive), a multimedia interface, etc., a transceiver 123 (capable of sending and / or receiving radio communication signals), a camera 155 (capable of capturing still and dynamic digital video images), and an external USB port 125. Optionally, the interface connected to the I / O interface 115 may be a USB interface.

[0106] The processor 103 may be any conventional processor, including a reduced instruction set computing (RISC) processor, a complex instruction set computing (CISC) processor, or a combination thereof. Alternatively, the processor may be a dedicated device such as an ASIC.

[0107] Electronic device 101 can communicate with software deployment server 149 via network interface 129. Exemplarily, network interface 129 is a hardware network interface, such as a network card. Network 127 can be an external network, such as the Internet, or an internal network, such as Ethernet or a virtual private network (VPN). Alternatively, network 127 can be a wireless network, such as a WiFi network or a cellular network.

[0108] The hard drive interface 131 is coupled to the system bus 105. The hard drive interface is connected to the hard drive 133. The internal memory 135 is coupled to the system bus 105. The data running in the internal memory 135 may include the operating system (OS) 137 of the electronic device 101, the application 143, and the scheduler.

[0109] The operating system consists of a shell 139 and a kernel 141. Shell 139 is an interface between the user and the operating system's kernel. The shell is the outermost layer of the operating system. The shell manages the interaction between the user and the operating system: it waits for user input, interprets user input to the operating system, and processes various operating system output.

[0110] The kernel 141 consists of the parts of the operating system that manage memory, files, peripherals, and system resources. The kernel 141 directly interacts with the hardware. The operating system kernel typically runs processes and provides inter-process communication, CPU time slice management, interrupts, memory management, and I / O management.

[0111] The above describes the application scenarios and execution devices of the method provided in the embodiment of the present application. The following describes the specific execution process of the method provided in the embodiment of the present application. Please refer to Figure 3, which is a flowchart of an example startup acceleration method provided in the embodiment of the present application. As shown in Figure 3, the startup acceleration method of this example includes the following steps 301-303.

[0112] Step 301, obtain an instance snapshot and an instance template. The instance snapshot is obtained based on the started first instance. The instance snapshot is used to indicate the data generated by the first instance during operation. The instance template is used to indicate how the data is stored in the memory during the startup of the first instance.

[0113] In this embodiment, when it is necessary to start an instance, the electronic device can pre-acquire an instance snapshot and an instance template for accelerating the startup of the instance. Among them, the instance snapshot is created after the first instance is started, and the instance snapshot is essentially the instantaneous state of all the content contained in the started first instance. Therefore, the instance snapshot actually records all the data generated by the first instance during operation (including all the data generated by the first instance during the startup phase). In essence, the instance snapshot records the runtime memory state of the first instance (that is, the data corresponding to the first instance in the memory under a certain instantaneous state), that is, the instance snapshot records the data on which the running of the first instance depends. For example, the instance snapshot records the files, sockets, signals used by the first instance during operation, as well as information about other instances or functions that the first instance needs to call during operation.

[0114] Exemplarily, an instance snapshot may include multiple image files, each image file being used to indicate unique data generated by the first instance during operation. Furthermore, different image files may be used to indicate different types of data. For example, the multiple image files in the instance snapshot may be used to indicate the following data: 1. Files opened by the first instance; 2. Register information of the first instance; 3. Pipe symbols of the first instance; 4. Memory addresses used by the first instance; 5. Memory pages used by the first instance; 6. Processes and sub-process information scheduled by the first instance. In addition to the above data, the multiple image files in the instance snapshot may also indicate other data based on the actual operation of the instance, which is not specifically limited in this embodiment.

[0115] The first instance is an entity of the application during operation, such as a process, a thread, or a hyperthread. This embodiment does not limit the specific structure of the first instance.

[0116] Instance templates can be created based on instance snapshots. Specifically, an instance template can be understood as metadata for an instance snapshot, describing how the data indicated by the instance snapshot is stored in memory. In other words, an instance template describes how the data generated by the first instance during operation is stored in memory.

[0117] In one possible example, the instance snapshot and instance template may be pre-stored in the storage space of the electronic device, and the electronic device retrieves the instance snapshot from the local storage space. For example, after launching a first instance, the electronic device may create an instance snapshot based on all data generated by the first instance during operation, and store the instance snapshot in a pre-defined storage space. In this way, even after the first instance is closed, the electronic device can still retrieve the instance snapshot based on the pre-launched first instance from the storage space.

[0118] In another possible example, the electronic device may also obtain the instance snapshot and instance template from another location via a network. For example, the electronic device may obtain the instance snapshot and instance template from another device (such as a physical machine or a virtual machine) via a network. The instance snapshot is created by the other device based on the content of the first instance after the other device starts the first instance; the instance template is created by the other device based on the instance snapshot after the other device creates the instance snapshot.

[0119] For example, in the case where multiple servers provide cloud microservices, the electronic device described above may be server 1. When server 1 needs to start an instance, it may obtain an instance snapshot and instance template from server 2 via the network, so that server 1 can accelerate instance startup based on the instance snapshot and instance template. The instance snapshot and instance template may be created and saved by server 2 after starting the first instance.

[0120] Optionally, when the electronic device obtains the instance snapshot via a network, the electronic device may specifically obtain the instance snapshot from a shared data storage system via the network. The shared data storage system may be a data storage system shared by multiple devices. Multiple devices in the shared data storage system can quickly access data in the data storage system via the network, for example, by quickly reading data in the data storage system via RDMA.

[0121] That is to say, by using a shared data storage system to store instance snapshots and instance templates, electronic devices can quickly obtain instance snapshots from other devices during the execution of instance cold start, and reduce the transmission delay of instance snapshots, thereby improving the speed of subsequent instance startup of electronic devices.

[0122] Step 302: Based on the instance template, store the data indicated in the instance snapshot into the first memory.

[0123] In this embodiment, because the instance snapshot records the data generated during the operation of the first instance, the data generated during the operation of the first instance can be restored based on the instance snapshot. Furthermore, because the instance template indicates how the data generated during the operation of the first instance is stored in memory, the data restored from the instance snapshot can be stored in the memory of the current node based on the memory storage method indicated by the instance template, thereby filling the memory with the data required during the instance startup process.

[0124] Step 303: Resume the second instance based on the data stored in the first memory.

[0125] After the data indicated by the instance snapshot is stored in the first memory in a specified manner, it indicates that all data required for the electronic device to start the second instance has been prepared, so the electronic device can start the second instance based on the data stored in the memory. During the startup of the second instance, the second instance can specifically run within a virtual machine, container, or container group (Pod), that is, the specific operating environment of the second instance is a virtual machine, container, or Pod.

[0126] In this embodiment, the first and second instances are instances of the same type (for example, both are processes, threads, or hyperthreads) and can provide the same instance services. The difference is that the first and second instances run in different operating environments. For example, the first and second instances run on different physical machines, different virtual machines, or different containers or pods.

[0127] In this solution, by obtaining the instance snapshot created based on the started instance and the instance template created based on the instance snapshot, the data generated by the started instance during operation can be obtained and the storage method of this data in the memory can be known. Then, referring to the storage method indicated by the instance template, the data indicated by the instance snapshot is filled into the corresponding position of the current node memory, so as to restore the running instance based on the data stored in the memory, avoid the instance initialization process with a long execution delay (that is, the process of code compilation and execution), and improve the speed of instance startup.

[0128] Optionally, the first instance and the second instance may be instances in a microservices architecture. In a microservices architecture, an application is composed of many loosely coupled and independently deployable smaller services, and the first instance and the second instance may be instances of one of the services, capable of implementing a set of independent features or functions.

[0129] The above introduces the process of an electronic device quickly starting an instance based on an instance snapshot. However, in some scenarios, multiple instances of the same type may need to be started on the same electronic device (for example, the same physical machine or virtual machine) to support high-concurrency user access requirements. In this case, in order to ensure the independent operation of instances of the same type, it is often necessary to isolate different instances through containers or Pods. Based on this, in the scenario of starting multiple identical instances on the same physical machine or virtual machine, this embodiment also provides an implementation method for further accelerating the subsequent instance startup process.

[0130] For example, in step 302, the first memory may be a shared memory, and the data stored in the first memory may be used to restore one or more instances of the same type. The shared memory serving as the first memory is a memory in an electronic device, and different instances running on the electronic device may share data in the shared memory.

[0131] In this way, when multiple instances of the same type are started on the same electronic device, the shared data in the shared memory can be used to quickly start the instance, avoiding the process of storing the data indicated in the instance snapshot in the memory again, thereby improving the speed of instance startup.

[0132] For ease of understanding, the following describes the process of quickly resuming the second instance by combining the specific contents indicated in the instance snapshot and instance template.

[0133] First, regarding the obtained instance snapshot, the instance snapshot can specifically be multiple image files obtained by serializing data generated by the first instance during operation according to specific specifications. Each image file is used to indicate unique data generated by the first instance during operation. For example, the multiple image files in the instance snapshot can be used to indicate the following data: 1. Files opened by the first instance; 2. Register information of the first instance; 3. Pipe symbols of the first instance; 4. Memory addresses used by the first instance; 5. Memory pages used by the first instance; 6. Process and subprocess information scheduled by the first instance.

[0134] For instance templates, the instance templates are specifically used to describe the attributes of the data indicated in the instance snapshot, so that the electronic device can store the data indicated in the instance snapshot in the memory of the current electronic device in the same way as the first instance stores this data during operation, ensuring that the data required for instance startup can be correctly stored in the memory.

[0135] Specifically, the data in an instance template can include three types of data. The first type of data describes the data structure of the data indicated in the instance snapshot; the second type of data describes the operating status of the first instance at the time the instance snapshot was created; and the third type of data describes the in-memory storage status of the data indicated in the instance snapshot. The following describes the specific content of each type of data.

[0136] The first type of data is actually a data structure that describes the data, which may include but is not limited to the following parts: 1. The data structure of the metadata information of multiple image files corresponding to the instance snapshot; 2. The data structure description of the files used by the first instance; 3. The data structure description of the register information used by the first instance; 4. The data structure description of the process address space used by the first instance; 5. The data structure of the memory page information of the first instance; 6. The data structure of the first instance and child process information.

[0137] The second type of data indicates the actual running state of the first instance at the time the instance snapshot was created. The second type of data may include, but is not limited to, the following: 1. The freeze time of the first instance; 2. The address space pointer of the first instance (i.e., the specific location at which the first instance is executing); 3. The number of memory pages that the first instance can copy using copy-on-write; 4. The memory page cache size of the first instance; and 5. Whether the memory pages of the first instance are lazy loaded.

[0138] The third type of data indicates the storage status of the data indicated in the instance snapshot in the memory. The third type of data may specifically include but is not limited to the following multiple parts: 1. The size information of the memory page used by the first instance, that is, the size of the memory area occupied by the data required to run the first instance. Among them, the size information of the memory page used by the first instance can be described by the page mapping file of the first instance. These page mapping files include which virtual areas corresponding to the first instance need to be filled with data, that is, they record the mapping status of the private virtual pages of the first instance to the physical pages, so that the size information of the memory pages actually used by the first instance can be determined. 2. The actual data that needs to be stored in the memory page in the instance snapshot, that is, which data indicated in the instance snapshot needs to be stored in the memory.

[0139] In the above step 302, the following steps 3021-3023 may be specifically included.

[0140] Step 3021: Based on the data structure indicated by the instance template, parse the instance snapshot to obtain the data indicated in the instance snapshot.

[0141] Because the first type of data in the instance template is used to describe the data structure of the data indicated in the instance snapshot, the instance snapshot can be parsed based on the first type of data in the instance template to restore the data indicated in the instance snapshot. Specifically, if the multiple image files corresponding to the instance snapshot are serialized data generated by the first instance, the multiple image files corresponding to the instance snapshot can be deserialized based on the data structure indicated by the instance template to restore the data actually indicated in the instance snapshot.

[0142] Step 3022: Determine a first area in the first memory for storing data based on the size of the memory area.

[0143] In addition, the third type of data in the instance template indicates the size of the memory area to be occupied by the data generated by the first instance. Therefore, based on the size of the memory area, a first area for storing the data generated by the first instance can be determined in the first memory. The size of the first area is consistent with the size of the memory area indicated in the instance template, that is, the first area is greater than or equal to the size of the memory area indicated in the instance template.

[0144] In addition, in the process of determining the first area in the first memory, the three parts of the second type of data mentioned above can also be combined: the number of memory pages on which the first instance can perform memory copy operations based on the copy-on-write method; the memory page cache size of the first instance; and whether the memory pages of the first instance are lazy loaded, so as to determine the first area that can effectively implement data storage.

[0145] The first area determined in the first memory may be a continuous memory area, to ensure that data required for running the second instance can be stored in a continuous memory area, thereby avoiding memory pollution and affecting the normal operation of the second instance.

[0146] Step 3023: Store the data indicated in the instance snapshot into the first area in the first memory.

[0147] From the above introduction to the instance template, it can be seen that the third type of data in the instance template indicates which data indicated in the instance snapshot needs to be stored in the first memory. Therefore, based on the instructions of the instance template, the data indicated in the instance snapshot can be stored in the first area of ​​the first memory, thereby filling the first memory with all the data required to run the second instance, ensuring that the second instance can be restored normally later.

[0148] In addition, it should be noted that in order to ensure that the second instance can resume operation smoothly, the external data on which the second instance depends must also be consistent with the operating environment of the first instance on the current electronic device. For example, on the current electronic device, the file name and file path of the file required to run the second instance must be consistent with the file name and file path of the file required to run the first instance. In simple terms, the operating environment of the second instance must be consistent with the operating environment of the first instance, so that after restoring the data indicated by the instance snapshot in the memory of the electronic device currently running the second instance, the second instance can be successfully resumed.

[0149] In the above-mentioned step 303, in the process of resuming the operation of the second instance based on the data stored in the first memory, it can be based on the operation state indicated by the instance template, jumping to the instruction in the first address of the first memory and executing the instruction, wherein the instruction in the first address belongs to the data stored in the first memory, and the instruction in the first address corresponds to the instruction executed by the first instance in the operation state. In this way, when the instruction in the first address of the first memory is executed, the operation state of the second instance is the same as the operation state of the first instance at the time point of creating the instance snapshot. For example, in the actual application process, according to the address space pointer of the first instance indicated by the second type of data in the instance template, the assembler's "jump" instruction is called to jump to the state of the first instance at the time point of creating the instance snapshot, thereby resuming the operation of the second instance.

[0150] In this solution, by indicating the running status of the first instance at the creation time node of the instance snapshot in the instance template, it is possible to jump back to the corresponding instance running status after restoring the data required for instance operation to the first memory to achieve the recovery of the second instance, thereby eliminating the need to perform the tedious process required for the instance during initial startup (such as the business initialization phase introduced above), effectively improving the startup speed of the instance.

[0151] The following describes a process in which the electronic device continues to start other instances of the same type based on the data stored in the first memory.

[0152] Specifically, after the electronic device resumes running the second instance based on the data stored in the first memory, it can continue to resume running the new instance in the same Pod or other Pods by sharing the data stored in the first memory, thereby enabling the startup of multiple instances based on the same portion of data shared in the first memory. For example, in the case where the second instance is a process, the recovery of multiple processes of the same type is achieved by sharing physical memory pages (i.e., sharing the first area of ​​the first memory for storing data) through the parent-child process, without having to restore new memory resources from scratch.

[0153] In general, in this solution, when multiple instances of the same type are started on the same electronic device, the shared instance data in the shared memory can be used to quickly start each instance, avoiding the process of storing the data indicated by the instance snapshot in the memory again, thereby improving the speed of instance startup.

[0154] Optionally, for most instances, they often need to connect to BaaS during normal operation to obtain the data services provided by BaaS to ensure their normal operation. Therefore, the startup process of most instances also includes the process of establishing a connection with BaaS, such as establishing a Transmission Control Protocol (TCP) connection. Generally, when establishing a TCP connection with BaaS, the instance usually needs to use the three-way handshake protocol to establish the connection, which is slow to establish the connection, further extending the startup delay of the instance.

[0155] Based on this, in this embodiment, a proxy component is pre-established to maintain the connection with BaaS, so that the instance can directly access BaaS through the proxy component, avoiding the need to establish a connection with BaaS during the startup process, eliminating the delay in connection establishment and improving the startup speed of the instance.

[0156] For example, after the second instance is launched, it can access BaaS through a proxy component to obtain the data services provided by BaaS. BaaS provides data services for the operation of the second instance, such as cloud data / file storage, account management, message push, social media integration, and other services. The types of services provided by BaaS are not limited here. Furthermore, the proxy component is pre-established and is used to maintain a continuous connection with BaaS, allowing it to proxy the second instance's access to BaaS at any time.

[0157] That is, the second instance is used to access the BaaS through the proxy component, and the BaaS is used to provide data services for the operation of the second instance. Moreover, during the process of resuming the operation of the second instance, the proxy component maintains a connection with the BaaS.

[0158] Optionally, before the second instance resumes operation, the connection between the proxy component and BaaS can be obtained in advance. After the second instance resumes operation, the connection between the proxy component and BaaS is returned to the second instance, so that the second instance can access BaaS by accessing the proxy component. In addition, since the proxy component always maintains a connection with BaaS, and the proxy component can proxy the access behavior between the second instance and BaaS, when the second instance accesses the proxy component through RPC, the proxy component can act as an intermediary to convey the access behavior of the second instance to BaaS, and the second instance returns the data service provided by BaaS. That is, the proxy component implements the access behavior of the second instance to BaaS by maintaining a connection with BaaS, and for the second instance, the second instance does not feel the proxy behavior of the proxy component, and the second instance is equivalent to being able to directly obtain the data service provided by BaaS.

[0159] In this solution, a pre-established proxy component is used to maintain the connection with BaaS, and the proxy component is used to proxy the instance's access behavior to BaaS. This allows the instance to not need to re-establish a connection with BaaS during startup, reducing the time spent on establishing the connection and improving the startup speed of the instance.

[0160] The above describes the execution process of the startup acceleration method of the example provided by the embodiment of the present application. For ease of understanding, the specific process of starting the example based on the method provided by this embodiment will be described in detail below with reference to specific examples.

[0161] Specifically, the following describes in detail the process of accelerating the startup process by taking the instance to be started as the process.

[0162] Please refer to Figure 4, which is a flow chart of a process based on process snapshot acceleration startup process provided by an embodiment of the present application. As shown in Figure 4, node 1 includes a runtime management module (Runtime Manager) 1, a snapshot creation module, a process template management module 1, and a distributed memory data system worker (Worker) 1; node 2 includes a runtime management module 2, a process template client (Client), a distributed memory data system Client, a distributed memory data system Worker2, a process template management module 2, shared memory 1, shared memory 2, and an agent component. In addition, in addition to node 1 and node 2, a distributed memory data system management terminal (Master) and BaaS are also included.

[0163] Among them, the runtime management module is deployed in the container and is responsible for preparing the operating environment of the application process. The user process snapshot creation module is deployed in the container and is responsible for creating and restoring application snapshots. The distributed memory data system Worker is deployed on the node and is responsible for managing the shared memory on the node. The distributed memory data system Client is deployed in the container and is responsible for the read and write interaction between the Pod and the shared memory on the node. The distributed memory data system Master is responsible for global data management, that is, data management on all nodes. The process template management module is deployed on the node and is responsible for interacting with the snapshot creation module to create process templates. The process template Client is deployed in the container and is responsible for creating processes in the container based on the process template and process snapshot. The proxy component is deployed separately on the node and is responsible for proxying BaaS connections.

[0164] Specifically, in Figure 4, the process of accelerating the startup of a process by node 2 based on the process snapshot and process template created by node 1 includes steps A1-A4, B1-B7, and C1-C2. Steps A1-A4 create a process snapshot and process template for the already created process A; steps B1-B7 restore the process across nodes based on the process snapshot and process instance; and steps C1-C3 reuse connections to backend services through the proxy component.

[0165] In step A1, the runtime management module 1 in Pod 1 of node 1 notifies the snapshot creation module 1 to create a process snapshot. Furthermore, the proxy component maintains a connection with the BaaS so that the process can access the BaaS by accessing the proxy component.

[0166] Specifically, a process A may be pre-created in Pod1. During the creation of process A, it is often necessary to complete processes such as execution environment initialization (such as Java virtual machine initialization), framework initialization, and business initialization.

[0167] After the user sends a cold start instruction to the runtime management module 1 , the runtime management module 1 initiates a process of creating a process snapshot and a process template, that is, notifies the snapshot creation module 1 to create a process snapshot.

[0168] In this solution, the ServiceBridge Manager component can be used to manage one or more proxy components. Each proxy component can establish a connection with a different BaaS, and the proxy component always maintains a connection with the BaaS. Thus, when a process needs to access the BaaS, the ServiceBridge Manager component can return the connection between the proxy component and the BaaS to the process, allowing the process to access the BaaS through the proxy component without having to establish a connection with the BaaS.

[0169] In step A2, the snapshot creation module of node 1 creates a process snapshot based on the started process A.

[0170] If process A has already started, the snapshot creation module may kill process A and create a process snapshot based on all data generated by process A during startup and operation. That is, the process snapshot includes all data content of process A at a certain instant during operation. The process snapshot described in this embodiment corresponds to the instance snapshot described in the above embodiment.

[0171] The process snapshot may include multiple image files, each of which corresponds to a portion of unique information describing process A. For details, please refer to the above introduction.

[0172] In step A3, the process template management module 1 deployed on node 1 creates a process template based on the process snapshot of process A.

[0173] The process template corresponds to the instance template introduced in the above embodiment.

[0174] In step A4, the distributed memory data system Client deployed on node 1 synchronizes the process snapshot and process template of process A to the distributed memory data system Master through the distributed memory data system Worker, and the distributed memory data system Master synchronizes the process snapshot and process template to the distributed memory data system Workers on some nodes.

[0175] In short, in this embodiment, the transmission and sharing of process snapshots and process templates on each node are achieved through the distributed memory data system Master and the distributed memory data system Worker on each node.

[0176] In step B1, the runtime management module 2 deployed on the Pod 2 of the node 2 sends an instruction to restore the process A across nodes to the process template management module 2.

[0177] In step B2 , the process template management module 2 on node 2 searches for the process snapshot and process template corresponding to process A on Worker 2 of the distributed memory data system of node 2 .

[0178] In step B3, if the process template management module 2 does not find the process snapshot and process template corresponding to process A on the distributed memory data system Worker 2 of node 2, the distributed memory data system Worker 2 pulls the process snapshot and process template corresponding to process A from the distributed memory data system Master.

[0179] In step B4, Worker 2 of node 2 maps an area on shared memory 1 for storing process snapshots and process templates, and stores the area for process snapshots and process templates in shared memory 1. The Client of Pod 2 of node 2 reads the starting address of the process snapshot and process template in shared memory 1 from Worker 2 of node 2.

[0180] For example, distributed memory data system Worker 2 can use the mmap() function to map an area in shared memory 1. The distributed memory data system Client in Pod 2 on node 2 can read the starting addresses of the process snapshot and process template in shared memory 1 from distributed memory data system Worker 2 through an inter-process communication mechanism (such as a UNIX domain socket).

[0181] The shared memory 1 may implement memory copying in a copy-on-write manner instead of network transmission, thereby accelerating the reading and writing efficiency of process snapshots and process templates.

[0182] In step B5, the process template management module 2 in node 2 notifies the process template Client in Pod 2, so that the process template Client reads the process snapshot and process template corresponding to process A from the shared memory 1 through the distributed memory data system Client in a copy-on-write manner.

[0183] Shared memory 1 can be shared by multiple containers. Therefore, when different containers need to restore the same type of process, they can read the corresponding process snapshots and process templates from shared memory 1 through copy-on-write, thereby improving the efficiency of reading process snapshots and process templates between different containers.

[0184] In step B6, the process template Client in Pod 2 of node 2 restores the data in the process snapshot by deserialization based on the indication of the first type of data in the process template, and obtains the data generated by process A during the running period; and, based on the memory page size information and memory mapping information in the third type of data in the process template, the process template Client finds the memory area for storing the data restored in the process snapshot (i.e., the first area in the above embodiment) in shared memory 2, and stores the data restored in the process snapshot in the found memory area, thereby storing the data required for the recovery process in shared memory 2.

[0185] It should be noted that shared memory 2 can be memory shared by the same or different Pods in the same container. Therefore, when multiple processes of the same type need to be restored in the same container, the recovery of multiple processes can be achieved based on the process data stored in shared memory 2, without the need to re-store the data required for the recovery process into the memory (i.e., there is no need to execute step B6).

[0186] In step B7, the process template management module 2 calls the assembler's "jump" instruction based on the address space pointer in the second type of data of the process template to return to the state of the original process A executing to the process snapshot creation time point, and completes the recovery of process A1.

[0187] In addition, when Pod2 needs to restore multiple processes of the same type, the process template Client can restore process A1 and process A2 based on the data stored in shared memory 2.

[0188] In step C1, the proxy component in node 2 establishes a connection with BaaS in advance, and the proxy component always maintains the connection with BaaS.

[0189] In step C2, after process A1 and process A2 are started, they do not need to create a new connection, but access BaaS through the proxy component.

[0190] Specifically, after process A1 and process A2 are started, the ServiceBridge Manager component can return the connection between the proxy component and BaaS to process A1 and process A2, so that process A1 and process A2 reuse the connection between the proxy component and BaaS, that is, access to BaaS is achieved by accessing the proxy component.

[0191] In this way, processes A1 and A2 no longer need to re-establish a new connection with BaaS. Instead, the proxy component is responsible for the interaction between processes A1 and A2 and BaaS. Specifically, process 2 can access the proxy component through RPC, and the proxy component is responsible for proxying the access behavior of processes A1 and A2 to BaaS.

[0192] The above describes, with specific examples, how node 2 accelerates the startup of a process based on the process snapshot created in node 1. The following describes how to quickly start multiple processes based on the same process snapshot on the same node.

[0193] Please refer to Figure 5, which is a schematic diagram of a process for creating multiple processes on Node 2, according to an embodiment of the present application. As shown in Figure 5, in Node 2, Process Template Client 1 in Pod 2 reads the process snapshot and process template corresponding to Process A from Shared Memory 1 and, based on the instructions of the process template, stores the data restored from the process snapshot (hereinafter referred to as process data) in a specified manner in Shared Memory 2. In this way, Process Template Client 1 can restore Process A1 based on the process data stored in Shared Memory 2.

[0194] Pod 3 in Node 2 is located in the same container as Pod 2 and can share data in shared memory 2. Therefore, after Pod 2 stores the process data corresponding to Process A in shared memory 2, the process template Client 2 in Pod 3 can resume running Process A3 based on the process data already stored in shared memory 2. This eliminates the need to restore the process data in shared memory based on the process snapshot and process template, thus speeding up the process of starting multiple processes of the same type on the same node.

[0195] In general, different Pods on the same node can access the process data stored in shared memory 2 and, based on this process data, resume the corresponding process within the Pod, accelerating process startup. Similarly, within the same Pod, multiple processes of the same type can be resumed based on the process data stored in shared memory 2, accelerating process startup.

[0196] Please refer to Figure 6, which is a schematic diagram comparing the process of starting a process on different nodes provided in an embodiment of the present application. As shown in Figure 6, Node 1 follows the original process startup process to execute the process startup, and generates a corresponding process snapshot and process template based on the started process. Specifically, the process of starting a process on Node 1 includes four steps: creating the operating environment, initializing the operating environment, starting the framework, and initializing the service. The framework startup and service initialization require a long delay.

[0197] After node 1 generates a process snapshot, node 2 can obtain the process snapshot and process template from node 1 and store the process snapshot in node 2's shared memory 1. In this way, when node 2 actually starts the process, it only needs to perform the following two steps: restore the process data to shared memory 2 based on the process snapshot and process template, and resume running the process based on the process data in shared memory 2.

[0198] As can be seen from Figure 6, compared with node 1, node 2 no longer needs to execute processes such as framework startup and business initialization, which effectively reduces the process startup delay.

[0199] For example, please refer to Figure 7, which is a schematic diagram comparing the process of starting a process based on different methods provided in an embodiment of the present application. As shown in Figure 7, the original process startup process includes four steps: creating the operating environment, initializing the operating environment, starting the framework, and initializing the service. The framework startup and service initialization require a long delay.

[0200] After accelerating process startup by transferring process snapshots between nodes, the process startup process only includes two steps: creating a process template based on the process snapshot and starting the process based on the process template.

[0201] Furthermore, when more processes are started on the same node, the process startup can be further accelerated on the same node because the process data has been restored to the shared memory 2. Specifically, after the process startup is further accelerated on the same node, the process startup step only includes the step of starting the process based on the process data.

[0202] From the comparison in Figure 7, it can be seen that the startup acceleration method provided by this solution can effectively avoid the two time-consuming steps of executing the framework startup and business initialization. Instead, the process is started by restoring the process data to the shared memory based on the process template and process snapshot, which effectively reduces the process startup delay.

[0203] The above embodiments introduce the startup acceleration method of the example provided in the embodiments of the present application. The following will introduce the device for executing the startup acceleration method of the above example.

[0204] Please refer to Figure 8, which is a schematic diagram of the structure of a startup acceleration device of an example provided in an embodiment of the present application. As shown in Figure 8, the startup acceleration device of this example includes: an acquisition module 801, which is used to obtain an instance snapshot and an instance template, wherein the instance snapshot is obtained based on the first instance that has been started, and the instance snapshot is used to indicate the data generated by the first instance during operation, and the instance template is used to indicate how the data is stored in the memory during the startup of the first instance; a processing module 802, which is used to store the data indicated in the instance snapshot in the first memory based on the instance template; and the processing module 802 is also used to resume the operation of the second instance based on the data stored in the first memory.

[0205] In a possible implementation, the first memory is a shared memory, and data stored in the first memory is used to restore one or more instances of the same type.

[0206] In one possible implementation, the instance template is also used to indicate the running status of the first instance at the creation time of the instance snapshot; the processing module 802 is also used to: based on the running status indicated by the instance template, jump to the instruction in the first address of the first memory and execute the instruction, wherein, when executing the instruction, the running status of the second instance is the same as the running status of the first instance at the creation time of the instance snapshot.

[0207] In one possible implementation, the instance template is specifically used to indicate the size of the memory area occupied by the data indicated in the instance snapshot; the processing module 802 is also used to: determine a first area in the first memory for storing data based on the size of the memory area; and store the data indicated in the instance snapshot in the first area in the first memory.

[0208] In a possible implementation, the instance template is further used to indicate the data structure of the data indicated in the instance snapshot; the processing module 802 is further used to: parse the instance snapshot based on the data structure indicated by the instance template to obtain the data indicated in the instance snapshot.

[0209] In one possible implementation, the instance template is specifically used to indicate one or more of the following: the running status of the first instance at the creation time of the instance snapshot, the size of the memory area occupied by the data indicated in the instance snapshot, and the data structure of the data indicated in the instance snapshot.

[0210] In one possible implementation, the second instance is used to access the Backend as a Service (BaaS) through a proxy component, and the BaaS is used to provide data services for the operation of the second instance; during the process of resuming the operation of the second instance, the proxy component maintains a connection with the BaaS.

[0211] In a possible implementation, the acquisition module is further configured to acquire the connection between the proxy component and the BaaS; and the processing module is further configured to return the connection to the second instance after the second instance resumes operation.

[0212] In a possible implementation, the instance snapshot and the instance template are obtained from a running node of the first instance through a network.

[0213] In a possible implementation, the first instance and the second instance are processes, threads, or hyperthreads.

[0214] In one possible implementation, the first instance and the second instance are instances under a microservice architecture.

[0215] Next, an execution device provided in an embodiment of the present application is introduced. Please refer to Figure 9. Figure 9 is a structural schematic diagram of an execution device provided in an embodiment of the present application. The execution device 900 can be specifically manifested as a mobile phone, a tablet, a laptop computer, a smart wearable device, a server, etc., which is not limited here. Specifically, the execution device 900 includes: a receiver 901, a transmitter 902, a processor 903 and a memory 904 (wherein the number of processors 903 in the execution device 900 can be one or more, and Figure 9 takes one processor as an example), wherein the processor 903 may include an application processor 9031 and a communication processor 9032. In some embodiments of the present application, the receiver 901, the transmitter 902, the processor 903 and the memory 904 may be connected via a bus or other means.

[0216] The memory 904 may include a read-only memory and a random access memory, and provides instructions and data to the processor 903. A portion of the memory 904 may also include non-volatile random access memory (NVRAM). The memory 904 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.

[0217] Processor 903 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.

[0218] The methods disclosed in the above embodiments of the present application can be applied to or implemented by the processor 903. The processor 903 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 903 or by software instructions. The above processor 903 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 903 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 904, and processor 903 reads information in memory 904 and, in conjunction with its hardware, completes the steps of the above method.

[0219] Receiver 901 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 902 can be used to output digital or character information through the first interface. Transmitter 902 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 902 can also include a display device such as a display screen.

[0220] In an embodiment of the present application, in one case, the processor 903 is configured to execute the method in the embodiment corresponding to FIG. 3 .

[0221] The electronic device provided in the embodiment of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the rendering method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0222] Please refer to Figure 10, which is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present application. The present application also provides a computer-readable storage medium. In some embodiments, the method disclosed in Figure 3 above can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or products.

[0223] 10 schematically illustrates a conceptual partial view of an example computer-readable storage medium including a computer program for executing a computer process on a computing device, arranged in accordance with at least some embodiments presented herein.

[0224] In one embodiment, computer-readable storage medium 1000 is provided using signal-bearing medium 1001. Signal-bearing medium 1001 may include one or more program instructions 1002 that, when executed by one or more processors, may provide the functionality or portions of the functionality described above with respect to FIG3. Furthermore, program instructions 1002 in FIG10 also depict example instructions.

[0225] In some examples, signal bearing medium 1001 may include computer readable medium 1003 such as, but not limited to, a hard drive, compact disk (CD), digital video disk (DVD), digital tape, memory, ROM or RAM, and the like.

[0226] In some embodiments, the signal-bearing medium 1001 may include a computer-recordable medium 1004, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, or the like. In some embodiments, the signal-bearing medium 1001 may include a communication medium 1005, such as, but not limited to, a digital and / or analog communication medium (e.g., a fiber optic cable, a waveguide, a wired communication link, a wireless communication link, or the like). Thus, for example, the signal-bearing medium 1001 may be communicated via a wireless form of the communication medium 1005 (e.g., a wireless communication medium conforming to the IEEE 802 standard or other transmission protocol).

[0227] The one or more program instructions 1002 may be, for example, computer-executable instructions or logic-implemented instructions. In some examples, the computing device may be configured to provide various operations, functions, or actions in response to the program instructions 1002 communicated to the computing device via one or more of computer-readable media 1003, computer-recordable media 1004, and / or communication media 1005.

[0228] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0229] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0230] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0231] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

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

[0233] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0234] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0235] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. 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 application.

Claims

1. An accelerated startup method of an example, characterized in that: include: Obtaining an instance snapshot and an instance template, wherein the instance snapshot is obtained based on the started first instance, the instance snapshot is used to indicate data generated by the first instance during operation, and the instance template is used to indicate a storage method of the data in a memory during startup of the first instance; Based on the instance template, storing the data indicated in the instance snapshot in a first memory; The second instance is resumed based on the data stored in the first memory.

2. The method according to claim 1, characterized in that The first memory is a shared memory, and the data stored in the first memory is used to restore one or more instances of the same type.

3. The method according to claim 1 or 2, characterized in that: The instance template is specifically used to indicate the size of the memory area occupied by the data indicated in the instance snapshot; Based on the instance template, storing the data indicated in the instance snapshot in the first memory includes: Based on the size of the memory area, determining a first area in the first memory for storing the data; The data indicated in the instance snapshot is stored in the first area in the first memory.

4. The method according to claim 3, characterized in that The instance template is further specifically used to indicate a data structure of the data indicated in the instance snapshot; The storing, based on the instance template, the data indicated in the instance snapshot into the first memory further includes: Based on the data structure indicated by the instance template, the instance snapshot is parsed to obtain the data indicated in the instance snapshot.

5. The method according to any one of claims 1 to 4, characterized in that: The instance template is also used to indicate the running state of the first instance at the creation time point of the instance snapshot; The resuming the operation of the second instance based on the data stored in the first memory includes: Based on the running status indicated by the instance template, jump to the instruction in the first address of the first memory and execute the instruction, wherein, when executing the instruction, the running status of the second instance is the same as the running status of the first instance at the creation time point of the instance snapshot.

6. The method according to any one of claims 1 to 5, characterized in that: The instance template is specifically used to indicate one or more of the following: The running state of the first instance at the creation time of the instance snapshot, the size of the memory area occupied by the data indicated in the instance snapshot, and the data structure of the data indicated in the instance snapshot.

7. The method according to any one of claims 1 to 6, characterized in that: The second instance is used to access the backend as a service BaaS through a proxy component, and the BaaS is used to provide data services for the operation of the second instance; During the process of resuming the operation of the second instance, the proxy component maintains the connection with the BaaS.

8. The method according to claim 7, characterized in that The method further comprises: Acquire a connection between the proxy component and the BaaS; After the second instance resumes operation, the connection is returned to the second instance.

9. The method according to any one of claims 1 to 8, characterized in that: The instance snapshot and the instance template are obtained from the running node of the first instance through a network.

10. The method according to any one of claims 1 to 9, characterized in that: The first instance and the second instance are processes, threads, or hyperthreads.

11. The method according to any one of claims 1 to 10, characterized in that: The first instance and the second instance are instances under a microservice architecture.

12. An accelerated starting device according to an embodiment, characterized in that: include: an acquisition module, configured to acquire an instance snapshot and an instance template, wherein the instance snapshot is obtained based on a started first instance, the instance snapshot is used to indicate data generated by the first instance during operation, and the instance template is used to indicate a storage method of the data in a memory during startup of the first instance; A processing module, configured to store the data indicated in the instance snapshot into a first memory based on the instance template; The processing module is further used to resume running the second instance based on the data stored in the first memory.

13. The device according to claim 12, characterized in that The first memory is a shared memory, and the data stored in the first memory is used to restore one or more instances of the same type.

14. The device according to claim 12 or 13, characterized in that The instance template is specifically used to indicate the size of the memory area occupied by the data indicated in the instance snapshot; The processing module is further used for: Based on the size of the memory area, determining a first area in the first memory for storing the data; The data indicated in the instance snapshot is stored in the first area in the first memory.

15. The device according to claim 14, characterized in that The instance template is further specifically used to indicate a data structure of the data indicated in the instance snapshot; The processing module is further used for: Based on the data structure indicated by the instance template, the instance snapshot is parsed to obtain the data indicated in the instance snapshot.

16. The device according to any one of claims 12 to 15, characterized in that: The instance template is also used to indicate the running state of the first instance at the creation time point of the instance snapshot; The processing module is further used for: Based on the running status indicated by the instance template, jump to the instruction in the first address of the first memory and execute the instruction, wherein, when executing the instruction, the running status of the second instance is the same as the running status of the first instance at the creation time point of the instance snapshot.

17. The device according to any one of claims 12 to 16, characterized in that: The instance template is specifically used to indicate one or more of the following: The running state of the first instance at the creation time of the instance snapshot, the size of the memory area occupied by the data indicated in the instance snapshot, and the data structure of the data indicated in the instance snapshot.

18. The device according to any one of claims 12 to 17, characterized in that: The second instance is used to access the backend as a service BaaS through a proxy component, and the BaaS is used to provide data services for the operation of the second instance; During the process of resuming the operation of the second instance, the proxy component maintains the connection with the BaaS.

19. The device according to claim 18, characterized in that The acquisition module is further used to acquire the connection between the proxy component and the BaaS; The processing module is further configured to return the connection to the second instance after the second instance resumes operation.

20. The device according to any one of claims 12 to 19, characterized in that: The instance snapshot and the instance template are obtained from the running node of the first instance through a network.

21. The device according to any one of claims 12 to 20, characterized in that: The first instance and the second instance are processes, threads, or hyperthreads.

22. The device according to any one of claims 12 to 21, characterized in that The first instance and the second instance are instances under a microservice architecture.

23. A starting acceleration device according to an embodiment, characterized in that: The device comprises a memory and a processor; the memory stores codes, the processor is configured to execute the codes, and when the codes are executed, the device executes the method according to any one of claims 1 to 11.

24. A computer storage medium, characterized in that The computer storage medium stores instructions, which, when executed by a computer, enable the computer to implement the method of any one of claims 1 to 11.

25. A computer program product, characterized in that The computer program product stores instructions, which, when executed by a computer, cause the computer to implement the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Method and device for recovering running state of application program and storage medium

    CN113849339A

  • Instance starting method and device based on cloud platform

    CN114489956A

  • Non-service container starting method and related equipment

    CN114546581A

  • Snapshot image for the application state of unshareable and shareable data

    US6917963B1

Cited By

  • Microservice instance starting method and device, electronic equipment and storage medium

    CN119759450A

  • Mirror image file-based universal vehicle-mounted infotainment system rapid startup method

    CN120255967A