Application expansion method, device, system, storage medium and electronic device

By backing up and sharding the memory image file of the application process, using multi-threaded compression to generate a memory snapshot, and comparing it with the file system snapshot to determine the updated files and generate a difference file, the application process can be directly restored in the target container. This solves the problems of resource waste and low efficiency in existing technologies and achieves efficient application scaling.

CN116795479BActive Publication Date: 2026-11-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210260500.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-16
Publication Date
2026-11-20
Estimated Expiration
2042-03-16

AI Technical Summary

Technical Problem

Existing technologies using scaling methods result in wasted container resources and low efficiency because the target container needs to wait for the application process to initialize and reload before it can provide services.

Method used

By backing up and sharding the memory image file of the application process, multi-threaded compression is used to generate a memory snapshot, and the updated files are determined by comparing with the file system snapshot. A difference file is generated, and the application process is directly restored in the target container, avoiding real-time full backup.

Benefits of technology

It improves application scaling efficiency, reduces container memory resource waste, shortens application process recovery time, and ensures that application processes can provide services without initialization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116795479B_ABST
    Figure CN116795479B_ABST
Patent Text Reader

Abstract

The application discloses provides an application expansion method, an application expansion device, an application expansion system, a storage medium and an electronic device, and relates to the technical field of computers. The application expansion method comprises the following steps: backing up a memory image file of an application process, generating a backup file, and fragmenting the backup file to generate a plurality of backup subfiles; using a plurality of threads to compress the plurality of backup subfiles to generate a memory snapshot of the application process; acquiring a file system snapshot before the application process is started and a file system snapshot after the application process is started; comparing the file system snapshot before the application process is started with the file system snapshot after the application process is started to determine updated files of the file system; generating a difference file based on the memory snapshot of the process and the updated files of the file system; and sending the difference file so that a target container recovers the application process based on the difference file. The application discloses can improve the efficiency of application expansion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to an application expansion method, an application expansion device, an application expansion system, a storage medium, and an electronic device. Background Technology

[0002] With the rapid development of computer technology and the continuous increase in user data, the application load in a single container is too large to meet the normal operation requirements, so the container is usually expanded.

[0003] Currently, the main method for application scaling is the cold start method, which involves deploying the image file of the source container in the target container, starting the application and providing services to users through a cold start, thereby achieving the effect of application scaling.

[0004] However, the existing technology described above cannot immediately provide services to users after the application is scaled up in the target container. Instead, it needs to wait for the application to complete initialization and reload before it can provide services. This method wastes the resources of the target container and results in low application scaling efficiency. Summary of the Invention

[0005] The purpose of this disclosure is to provide an application scaling method, application scaling device, application scaling system, storage medium, and electronic device, thereby overcoming, at least to some extent, the problems of container resource waste and low application scaling efficiency.

[0006] According to a first aspect of this disclosure, an application scaling method is provided, applied to a source container, comprising: backing up a memory image file of an application process to generate a backup file, and splitting the backup file into multiple backup sub-files; compressing the multiple backup sub-files using multiple threads to generate a memory snapshot of the application process; obtaining a file system snapshot before the application process starts and a file system snapshot after the application process starts, comparing the file system snapshot before the application process starts with the file system snapshot after the application process starts to determine the updated file system file; generating a difference file based on the process's memory snapshot and the updated file system file, and sending the difference file so that the target container can restore the application process based on the difference file.

[0007] Optionally, the application scaling method applied to the source container also includes: after the application process starts, controlling the application process to stop running in order to obtain a file system snapshot after the application process starts.

[0008] Optionally, the file system snapshot before the application process starts is compared with the file system snapshot after the application process starts to determine the updated file system file. This includes: obtaining the file parameters of the file system snapshot before the application process starts and the file parameters of the file system snapshot after the application process starts, where the file parameters are the status information of each file in the file system snapshot; and comparing the contents of each file in the file system snapshot one by one based on the file parameters of the file system snapshot before the application process starts and the file parameters of the file system snapshot after the application process starts to determine the updated file system file.

[0009] Optionally, before generating a memory snapshot of the application process, the method further includes: clearing the middleware state of the application process so that the restored application process can connect with the middleware and control the operation of the restored application process.

[0010] Optionally, after sending the difference file to the target container, the system may also include: controlling the application process to run after sending the difference file.

[0011] According to a second aspect of this disclosure, an application expansion device is provided, applied to a source container, comprising: a generation module, a determination module, a sending module, and a control module.

[0012] Specifically, the generation module is used to back up the memory image file of the application process, generate a backup file, and split the backup file into multiple backup sub-files; the generation module is also used to compress multiple backup sub-files using multiple threads to generate a memory snapshot of the application process; the determination module is used to obtain a file system snapshot before the application process starts and a file system snapshot after the application process starts, compare the file system snapshot before the application process starts with the file system snapshot after the application process starts, and determine the updated file of the file system; the sending module is used to generate a difference file based on the memory snapshot of the application process and the updated file system file, and send the difference file so that the target container can restore the application process based on the difference file.

[0013] Optionally, the device also includes a control module for controlling the application process to stop running after the application process starts, so as to obtain a file system snapshot after the application process starts.

[0014] Optionally, the determination module can also be used to obtain the file parameters of the file system snapshot before the application process starts and the file parameters of the file system snapshot after the application process starts. The file parameters are the status information of each file in the file system snapshot. Based on the file parameters of the file system snapshot before the application process starts and the file parameters of the file system snapshot after the application process starts, the content of each file in the file system snapshot is compared one by one to determine the updated file of the file system.

[0015] Optionally, the device also includes a clearing module, specifically used to clear the middleware state of the application process so that the restored application process can connect with the middleware and control the operation of the restored application process.

[0016] Optionally, the control module is used to control the application process to run after the difference file is sent.

[0017] According to a third aspect of this disclosure, an application scaling method is provided, applied to a target container, comprising: receiving a difference file, the difference file containing a memory snapshot of the application process and an update file of the file system; fragmenting the backup file of the memory snapshot to generate multiple first backup sub-files, and using multiple threads to decompress the multiple first backup sub-files to generate multiple second backup sub-files; and restoring the application process based on the multiple second backup sub-files and the update file of the file system.

[0018] Optionally, after the application process is restored, the control SDK calls the recovery instance interface to restore the middleware. The recovery instance is used to implement network connectivity; the middleware state is restored so that the restored application process can continue to run in the same way as the application process before the source container cleaned up the middleware state.

[0019] According to a fourth aspect of this disclosure, an application expansion device is provided, applied to a target container, including a receiving module, a generating module, and a recovery module.

[0020] Specifically, the receiving module can be used to receive the difference file, which contains the application process memory snapshot and the file system update file; the generating module is used to segment the backup file of the application process memory snapshot to generate multiple first backup sub-files, and use multiple threads to decompress the multiple first backup sub-files to generate multiple second backup sub-files; based on the multiple second backup sub-files and the file system update file, the application process is restored.

[0021] Optionally, the device also includes a control module, specifically used to control the SDK after the application process is restored, so that it calls the recovery instance interface to realize middleware restoration. The recovery instance interface is used by the middleware to use the application process memory snapshot for network connection. The restoration module is used to restore the middleware state so that the restored application process can continue to run according to the application process before the source container cleaned up the middleware state.

[0022] According to a fifth aspect of this disclosure, an application expansion system is provided, comprising:

[0023] The source container backs up the application process's memory image file, generates a backup file, and segments the backup file to generate multiple backup sub-files. Multiple threads compress these sub-files to generate a memory snapshot of the application process. It also acquires file system snapshots before and after application process startup, compares these snapshots to identify updated file system files, and generates and sends a difference file based on the memory snapshot and updated file system files. The target container then receives the difference file, which contains the application process's memory snapshot and updated file system files. It segments the backup file of the application process's memory snapshot to generate multiple first backup sub-files and decompresses them using multiple threads to generate multiple second backup sub-files. Finally, it restores the application process based on these second backup sub-files and the updated file system files.

[0024] Optionally, the application scaling system also includes a cloud disk, which is used to receive the difference files sent by the source container and send the difference files to the target container.

[0025] According to a sixth aspect of this disclosure, a storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements any of the above-described application expansion methods.

[0026] According to a seventh aspect of this disclosure, an electronic device is provided, comprising:

[0027] Processor; and

[0028] Memory is used to store the processor's executable instructions;

[0029] The processor is configured to execute any of the above application expansion methods by executing executable instructions.

[0030] The application scaling method provided in this disclosure backs up the memory image file of the application process, generates a backup file, and then segments the backup file to generate multiple backup sub-files. Multiple threads are then used to compress these multiple backup sub-files to generate a memory snapshot of the application process. File system snapshots before and after the application process starts are obtained and compared to determine the updated files in the file system. Based on the memory snapshot of the application process and the updated files in the file system, a difference file is generated and sent so that the target container can restore the application process based on the difference file. This method uses a dump backup method to back up the memory image file of the application process, thereby avoiding real-time full backups of data generated during application process execution. Instead, it performs a difference backup only on the changed data after a full backup, thus reducing the waste of container memory resources. The generated backup file is then segmented, and multiple threads are used simultaneously for compression processing, accelerating data compression and transmission speed, and improving the efficiency of application scaling. Finally, by comparing the file system snapshot before the application process starts with the file system snapshot after the application process starts, files with different contents are identified. This allows the target container to restore the application process without needing to initialize or reload the application process, directly reaching a state where it can provide services to users, further improving the efficiency of application scaling.

[0031] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0032] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0033] Figure 1 A flowchart of an application scaling method for a source container provided in this disclosure embodiment;

[0034] Figure 2 A flowchart of an application scaling method for a target container provided in this disclosure embodiment;

[0035] Figure 3 This is a schematic diagram of a middleware processing method provided in an embodiment of the present disclosure;

[0036] Figure 4This is a schematic diagram of an application scaling method for complex applications provided in an embodiment of the present disclosure;

[0037] Figure 5 A block diagram of an application scaling device for a source container provided in an embodiment of this disclosure;

[0038] Figure 6 A block diagram of an application expansion device for a target container provided in an embodiment of this disclosure;

[0039] Figure 7 This is a schematic diagram of an application expansion system provided in an embodiment of the present disclosure;

[0040] Figure 8 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0041] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0042] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0043] The flowchart shown in the attached diagram is merely an illustrative example and does not necessarily include all steps. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0044] The application scaling method provided in this disclosure can be applied to application scenarios where the business access volume of application processes in containers is high. For example, when the business access volume of an enterprise's application processes is high, in order to ensure the stable operation of the application and improve the user experience, application scaling between containers is usually used.

[0045] Current technologies typically employ a cold start approach for scaling applications across containers. This involves deploying the source container's image into the target container and then starting the application process using a cold start method. However, this cold start approach requires waiting for the application process to complete configuration initialization and reloading after scaling to the target container before the scaled application can directly provide services or achieve its functionality. This method results in low application scaling efficiency.

[0046] This disclosure addresses the aforementioned problems by proposing an application scaling method. This method backs up the application process's memory image file, segments it, and then uses multiple threads to simultaneously compress multiple segmented backup files, increasing data transmission speed and thus improving application scaling efficiency. Simultaneously, by comparing file system snapshots in the source container before and after the application process starts, updated file system files are determined. This allows the application process in the target container to directly provide services or achieve functionalities based on the updated files. This avoids the problem in existing technologies where the application process needs to wait for configuration initialization and reloading after the target container is restored, ensuring the application process quickly reaches a state where it can provide services or achieve functionalities, thereby improving application scaling efficiency.

[0047] Figure 1 The flowchart illustrating an exemplary embodiment of the application scaling method of this disclosure is shown. This method is applied to a source container, which is a container containing application processes and requires application scaling to alleviate application process pressure. (Reference) Figure 1 The application scaling method may include the following steps:

[0048] S12: Back up the memory image file of the application process, generate a backup file, and split the backup file into multiple backup sub-files.

[0049] The application process refers to the application program that runs when the computer is used. The application process's memory image file contains process context information used by the application process during runtime, including file descriptions, middleware parameters, memory images, network connection parameters, kernel status parameters, etc. The memory image file is essential for the application process to run within a container. Backup refers to the process of copying all or part of a data set from the application host's hard drive or array to other storage media to prevent data loss due to operational errors or system failures. Sharding involves dividing a backup file into a series of backup sub-files of a specific size.

[0050] In an exemplary embodiment of this disclosure, a dump backup can be used to back up a memory image file. A dump backup can be performed by specifying a backup level, where each level can be divided into 0-9 levels. Level 0 is a full backup, meaning all files are backed up, and level 1 is a differential backup, meaning files whose content differs are backed up. Specifically, a dump backup is implemented by using level 0 for a full backup of the memory image file during the first backup. During the second backup, level 1 is used to back up only the differing parts, i.e., files whose content has been modified, added, or removed.

[0051] S14: Use multiple threads to compress multiple backup sub-files and generate a memory snapshot of the application process.

[0052] In this context, a thread refers to a single, sequential flow of control within a process. A process can have multiple threads running concurrently, and these threads can execute tasks in parallel. A memory snapshot of an application process is a record of the application process's memory data at a specific point in time, stored on disk as a file.

[0053] Specifically, multiple backup sub-files can be compressed concurrently by multiple threads. Compression can be performed using compression tools or compression algorithms, such as the lz4 compression algorithm. The lz4 compression algorithm is a lossless compression algorithm with extremely fast compression and decompression speeds, meaning it has high compression and decompression efficiency.

[0054] It should be understood that the number of threads can be the same as, more than, or less than the number of backup sub-files. Data compression efficiency is better when the number of threads is not less than the number of backup sub-files. This disclosure does not specifically limit the number of threads; all such threads are within the scope of this disclosure.

[0055] S16: Obtain a file system snapshot before the application process starts and a file system snapshot after the application process starts. Compare the file system snapshot before the application process starts with the file system snapshot after the application process starts to determine the updated files in the file system.

[0056] File system snapshots are generated by taking a snapshot of the file system at a specific point in time, and they allow you to view the status information of each file. Updated files are collections of files whose content has changed, such as files that have been modified, newly added files, or deleted files.

[0057] In one possible implementation, after the application process starts, the application process is stopped to obtain a file system snapshot of the application process after it starts.

[0058] In an exemplary embodiment of this disclosure, when the source container needs to scale up the application after the application process has started, the application process can be stopped by controlling the SDK based on a preset port. After the application process stops running, the file content in the file system will no longer change, and a file system snapshot after the application process started can be generated at this time.

[0059] By controlling the application process to stop running before obtaining a file system snapshot after the application process starts, it is possible to ensure that the content of the file system snapshot after the application process starts will not be modified, which would cause the recovery failure in the target container. This ensures the success rate of application expansion and further improves the efficiency of application expansion.

[0060] Furthermore, after determining the file system snapshots before and after the application process starts, the file parameters of both snapshots are obtained. These file parameters contain the status information of each file in the file system snapshots. Based on these parameters, the content of each file in the file system snapshots is compared one-to-one to determine the files to be updated in the file system.

[0061] Specifically, file status information includes the file's absolute path, size, and last operation time, which can be obtained from file system snapshots. The file system contains a large number of files, and each file's location can be quickly determined using its status information. The content of the same file is compared between the file system snapshot before the application process started and the file system snapshot after the application process started to identify sets of files with differing content, such as modified files, newly added files, and deleted files. These sets of files constitute the updated files of the file system, which are then compressed using a compression algorithm. For example, the lz4 compression algorithm can be used.

[0062] By comparing the file parameters of the file system snapshot before the application process starts with those of the file system snapshot after the application process starts, the specific location of each file can be quickly located, enabling rapid comparison of the content of the same file, reducing the time required to determine the updated files in the file system, and further improving the efficiency of application expansion.

[0063] S18: Based on the application process's memory snapshot and the file system's update files, generate a difference file, send the difference file so that the target container can restore the application process based on the difference file.

[0064] Specifically, the memory snapshot of the application process and the updated files of the file system are compressed to generate a difference file, for example, using the lz4 compression algorithm.

[0065] In an exemplary embodiment of this disclosure, after the difference file is sent, the source container controls the execution of the application process.

[0066] After the difference file is successfully transferred, the source container control SDK relinquishes control of the application process, allowing the application to continue providing services to users. Simultaneously, the difference file can be uploaded to a cloud drive for further transmission.

[0067] The application scaling method provided in this disclosure backs up the memory image file of the application process, generates a backup file, and then segments the backup file to generate multiple backup sub-files. Multiple threads are then used to compress these multiple backup sub-files to generate a memory snapshot of the application process. File system snapshots before and after the application process starts are obtained and compared to determine the updated files in the file system. Based on the memory snapshot of the application process and the updated files in the file system, a difference file is generated and sent so that the target container can restore the application process based on the difference file. This method uses a dump backup method to back up the memory image file of the application process, thereby avoiding real-time full backups of data generated during application process execution. Instead, it performs a difference backup only on the changed data after a full backup, thus reducing the waste of container memory resources. The generated backup file is then segmented, and multiple threads are used simultaneously for compression processing, accelerating data compression and transmission speed, and improving the efficiency of application scaling. Finally, by comparing the file system snapshot before the application process starts with the file system snapshot after the application process starts, files with different contents are identified. This allows the target container to restore the application process without needing to initialize or reload the application process, directly reaching a state where it can provide services to users, further improving the efficiency of application scaling.

[0068] and Figure 1 The application expansion method shown corresponds to, Figure 2 A flowchart illustrating an exemplary embodiment of the application scaling method applied to a target container is shown schematically. (Reference) Figure 2 The application scaling method applied to the target container may include the following steps:

[0069] S22: Receive the difference file, which contains a memory snapshot of the application process and updated files for the file system.

[0070] In an exemplary embodiment of this disclosure, after the source container generates the difference file, it can transmit the difference file to a cloud disk. The target container can then download it from the cloud disk to receive the difference file.

[0071] S24: Segment the backup file of the application process memory snapshot to generate multiple first backup sub-files, and use multiple threads to decompress the multiple first backup sub-files to generate multiple second backup sub-files.

[0072] Specifically, the difference file contains a snapshot of the application process's memory, which is a compressed backup file. When restoring the application process's memory snapshot, the backup file can be fragmented into multiple first backup sub-files. Multiple threads are then used to simultaneously decompress and generate multiple second backup sub-files. The target container can then restore the application process based on the decompressed second backup sub-files. The decompression operation can utilize the LZ4 compression algorithm to improve decompression efficiency.

[0073] In an exemplary embodiment of this disclosure, when restoring an application process memory snapshot, multiple threads can be used to directly decompress the backup file; however, this method places high demands on the memory resources of the target container.

[0074] S26: Restore the application process based on multiple second backup subfiles and updated files in the file system.

[0075] In the exemplary embodiments of this disclosure, after the application process restored using the second backup sub-file is started, it can directly reach a runnable state based on the updated files in the file system, without needing to re-initialize the application process and reload data. For example, if the source container contains an application process for smart air conditioner control, and user A is a registered user bound to air conditioner devices a and b in the home, when the application is expanded to the target container, the target container can directly obtain user A and the air conditioner devices a and b bound to the user based on the updated files in the file system. That is, user A does not need to register again or re-bind to the devices, and the application process can directly provide control services for air conditioners a and b to user A.

[0076] In the application scaling method disclosed herein, the target container receives a difference file containing an application process memory snapshot and file system update files. The backup file of the application process memory snapshot is fragmented to generate multiple first backup sub-files. Multiple threads are then used to decompress these first backup sub-files, generating multiple second backup sub-files. Finally, based on these second backup sub-files and the file system update files, the application process is restored. This method, by fragmenting the application process memory snapshot before simultaneous decompression, reduces the time required to restore the application process. Simultaneously, the file system update files allow the restored application process to directly reach a service-ready state without initialization or reloading, thereby improving the efficiency of application scaling.

[0077] Complex applications, involving intricate functionalities and interactions with system software, require middleware for communication between multiple application processes and the system software. Middleware connects different parts of an application process or links an application process with the system software over a network, enabling resource and functionality sharing.

[0078] In the above Figure 1 and Figure 2 Based on this, for applications containing middleware, it will combine Figure 3 The middleware processing method is explained in detail. For example... Figure 3 As shown, Figure 3 This is a schematic diagram of a middleware processing method provided in an embodiment of the present disclosure.

[0079] First, in step S32, the middleware state is cleared. Clearing the middleware state of the application process allows the restored application process to connect with the middleware and control its operation. The middleware state refers to the status information of the middleware during the application process's execution. When the application is scaled up to the target container, the change in the container's Internet Protocol Address (IP) can prevent the middleware state from being updated in the target container, potentially leading to application scaling failure.

[0080] Specifically, during application runtime, middleware facilitates interaction between the application process and system software within the source container via network connections, enabling the application process to provide functions or services to users. Simultaneously, the middleware generates real-time status information, such as whether its operational status is abnormal, the status of the monitoring message queue manager, and the channel's operational status. The middleware state generated during application runtime can become abnormal due to network connection interruptions when the application is scaled up to the target container, leading to application process recovery failure and ultimately application scaling failure. Therefore, it is necessary to clear the middleware state before obtaining the application process's memory image file to ensure that the middleware is stateless during backup operations.

[0081] Secondly, in step S34, the recovery instance interface is registered. Specifically, after the application process is built, the middleware registers the recovery instance interface with the SDK. When the source container needs to scale up the application, to avoid the abnormal middleware state affecting the recovery of the application process in the target container, the middleware state is cleared by calling the clear middleware instance interface through a preset port driver SDK. For example, when the application process in container 1 can provide services to users normally, the middleware in the application process registers the corresponding recovery instance interface with the SDK. When the number of users increases sharply and the application process in container 1 cannot provide normal services to users, the application in container 1 can be scaled up to container 2. Container 1 can clear the middleware state through the clear middleware instance interface, while container 2 can reconnect to the network through the recovery instance interface.

[0082] In step S36, the recovery instance interfaces registered by each middleware are synchronously generated in the target container SDK. Registering the recovery instance interfaces in the source container SDK allows the synchronization of pre-registered recovery instance interfaces of each middleware in the target container's recovery SDK.

[0083] It should be understood that the number of middleware contained in an application process can be zero or one or more, without any specific limitation.

[0084] Finally, once the application process is restored in the target container, it can provide services or implement functions for the business side. In step S38, the application process is restored by calling the restore instance interface.

[0085] In the exemplary embodiments of this disclosure, middleware recovery is still required for complex application processes. When the target container detects that the application process has been restored, it controls the SDK to call the middleware to its pre-registered recovery instance interface to reconnect to the network. The middleware can then interact between the application process and the system software via the network, restore the middleware state, and thus provide services to the business side.

[0086] In this embodiment, the application scaling method for complex applications cleans up the middleware state in the source container and calls the recovery instance interface to reconnect the network when the application process is restored in the target container, thereby restoring the middleware and its state. This realizes the scaling process of complex applications, expands the scope of application scaling, and further improves the efficiency of application scaling.

[0087] Based on any of the above embodiments, reference will be made to Figure 4 The entire expansion process of the application expansion method according to the exemplary embodiments of this disclosure will be described in detail. Figure 4 This is a schematic diagram illustrating the process of an overall application expansion method provided in an embodiment of this disclosure.

[0088] Once the application process within the source container starts, the application scaling process begins. First, in step S402, the application process is stopped, and the middleware state is cleaned up.

[0089] In an exemplary embodiment of this disclosure, the source container can control the SDK to stop the application process and clean up the middleware state. Stopping the application process ensures that the middleware does not generate new states, and the middleware state is prone to abnormalities during rapid application recovery, leading to application scaling failure. Therefore, stopping the application process and cleaning up the middleware state is prioritized. Furthermore, to facilitate middleware recovery in the target container, the middleware can pre-register a recovery instance interface with the SDK before cleaning up the middleware state.

[0090] After cleaning up the middleware state, step S404 is executed to generate an application process memory snapshot. For example, a memory image file of the application process is obtained. This memory image file contains necessary files used by the application process during runtime, such as file description information, middleware parameter information, memory image, network connection parameters, kernel status parameters, and other application process context information files. The obtained memory image file is backed up and then fragmented to generate multiple backup sub-files. Multiple threads are used to compress these multiple backup sub-files simultaneously, generating a memory snapshot of the application process.

[0091] In step S406, an update file for the file system is generated. In an exemplary embodiment of this disclosure, file system snapshots are obtained before the application process starts and after the application starts, respectively. The file system snapshot after the application starts is collected after the SDK controls the application process to stop running. Based on the file system snapshots, the status information of each file in the file system before and after the application process starts can be obtained, such as the absolute path of the file, the file size, and the last operation time. This status information helps the source container quickly locate the position of the same file in the file system before and after the application process starts, and compare the file content to quickly identify the set of files with different content, and generate an update file for the file system.

[0092] In an exemplary embodiment of this disclosure, after generating the update file of the file system, the update file can be compressed to speed up the file transfer rate. The compression can be achieved using a compression algorithm, such as the lz4 compression algorithm.

[0093] In step S408, the application is sent to the cloud drive. The source container processes the generated memory snapshot of the application process and the updated files of the file system using a compression algorithm, and generates a difference file which is then sent to the cloud drive. Finally, in step S410, the application process is restored. The source container controls the SDK to resume the operation of the application process, allowing the source container to continue providing services or implementing functions for the user.

[0094] Simultaneously, after confirming that the target container is the container for application scaling, the target container can download the difference file from the cloud disk. This difference file contains an application process memory snapshot and updated file system files. In step S414, the application process memory snapshot is restored to recover the application process. The application process memory snapshot is specifically a backup file of the application process memory image file. Therefore, the application process memory snapshot, i.e., the backup file, can be fragmented, and multiple threads can be used simultaneously to decompress and sequentially import it into the target container, thereby completing the application process recovery.

[0095] The application process restored based on the application process memory snapshot cannot reach a state where it can provide services or implement functions for users. Therefore, step S412 needs to be executed first. In S412, the updated files of the file system are restored. The updated files of the file system are decompressed to restore the file system in the target container. The application process in the target container obtains the data that has been completed in the source container based on the updated files, and can directly provide services or implement functions without re-initializing the application process and reloading data.

[0096] Finally, in step S416, the middleware is restored and its state is restored. Because the IP address of the target container after application scaling changes compared to the source container, the middleware's network connection is interrupted, preventing communication between the application process and system software, thus hindering service provision. Therefore, middleware restoration is necessary.

[0097] Specifically, this disclosure illustrates a method for restoring middleware, which involves adding a recovery instance interface to the SDK. When the target container detects that the application process has recovered, it controls the SDK to call the middleware's pre-registered recovery instance interface. Through the recovery instance interface, business parameters can be input to reconnect to the network, thereby restoring the middleware state. The business parameters can be parameter information already generated by the application process in the source container, or they can be re-inputted from the target container, depending on the specific needs of the application process's business side.

[0098] Table 1 shows a comparison of the application expansion time for applications A, B, C, and D using the existing cold start method versus the application expansion time of the present disclosure. As can be seen from the comparison results in Table 1, the application expansion method provided by the present disclosure can improve application expansion efficiency.

[0099] Table 1

[0100] Cold start time The public launch time Application A 39.878 seconds 3.853 seconds Application B 57.163 seconds 5.133 seconds Application C 18.932 seconds 4.652 seconds Application D 2 minutes 8.225 seconds

[0101] In this embodiment, by backing up and sharding the memory image file of the application process in the source container, and using multiple threads to compress it simultaneously, and by sharding and decompressing the backup file of the difference file in the target container, the speed of file transfer and data processing is improved. At the same time, the file system update file is generated so that when the application process is restored in the target container, it can directly reach the state of providing services or realizing functions for users, thereby improving the speed of application process restoration and thus improving the efficiency of application expansion.

[0102] Figure 5 The schematic diagram illustrates a block diagram of an application expansion device according to an exemplary embodiment of this disclosure. For example... Figure 5 As shown, the application expansion device 5 applied to the source container in the exemplary embodiment of this disclosure may include: a generation module 51, a determination module 53, a sending module 55, a control module 57, and a clearing module 59.

[0103] Specifically, the generation module 51 can be used to back up the memory image file of the application process, generate a backup file, and split the backup file into multiple backup sub-files; the generation module 51 is also used to compress multiple backup sub-files using multiple threads to generate a memory snapshot of the application process; the determination module 53 is used to obtain a file system snapshot before the application process starts and a file system snapshot after the application process starts, compare the file system snapshot before the application process starts with the file system snapshot after the application process starts, and determine the updated file of the file system; the sending module 55 is used to generate a difference file based on the memory snapshot of the process and the updated file system file, and send the difference file so that the target container can restore the application process based on the difference file.

[0104] According to an exemplary embodiment of the present disclosure, the device further includes a control module 57, specifically configured to control the application process to stop running after the application process starts, so as to obtain a file system snapshot after the application process starts.

[0105] According to an exemplary embodiment of this disclosure, the determining module 53 is further configured to obtain file parameters of the file system snapshot before the application process starts and file parameters of the file system snapshot after the application process starts, wherein the file parameters are the status information of each file in the file system snapshot; based on the file parameters of the file system snapshot before the application process starts and the file parameters of the file system snapshot after the application process starts, the content of each file in the file system snapshot is compared one by one to determine the updated file of the file system.

[0106] According to an exemplary embodiment of the present disclosure, the apparatus further includes a clearing module 59, specifically used to clear the middleware state of the application process so that the restored application process can connect with the middleware and control the operation of the restored application process.

[0107] According to an exemplary embodiment of this disclosure, the control module 57 is further configured to control the application process to run after sending the difference file.

[0108] Figure 6 The schematic diagram illustrates a block diagram of an application scaling device applied to a target container according to an exemplary embodiment of this disclosure. For example... Figure 6 As shown, the application expansion device 6 applied to the target container in the exemplary embodiment of this disclosure includes: a receiving module 61, a generating module 63, a recovery module 65, and a control module 67.

[0109] Specifically, receiving module 61 is used to receive a difference file, which contains an application process memory snapshot and an updated file of the file system; generating module 63 is used to segment the backup file of the application process memory snapshot to generate multiple first backup sub-files, and to decompress the multiple first backup sub-files using multiple threads to generate multiple second backup sub-files; and recovery module 65 is used to restore the application process based on the multiple second backup sub-files and the updated file of the file system.

[0110] According to an exemplary embodiment of this disclosure, the device further includes a control module 67, which controls the SDK to call the recovery instance interface to realize middleware recovery after the application process is restored, and the recovery instance can realize network connectivity; the recovery module 65 is also used to restore the middleware state so that the restored application process can continue to run according to the application process before the source container cleaned up the middleware state.

[0111] By utilizing the application scaling devices applied to the source container and the target container, the target container segments the application process memory snapshot and then decompresses it simultaneously, reducing the time required to restore the application process. Simultaneously, file system updates ensure that the restored application process does not require initialization or reloading, directly reaching a service-ready state, thus improving the efficiency of application scaling.

[0112] Furthermore, this example implementation also provides an application expansion system.

[0113] refer to Figure 7 As shown, the application expansion system includes a source container 71, a target container 73, and a cloud disk 75. Among them:

[0114] Source container 71 can be used to back up the memory image file of the application process, generate a backup file, and split the backup file into multiple backup sub-files. Multiple threads are used to compress the multiple backup sub-files to generate a memory snapshot of the application process. The system snapshots before and after the application process starts are obtained. The system snapshots before and after the application process starts are compared to determine the updated files of the system. Based on the memory snapshot of the application process and the updated files of the system, a difference file is generated and sent so that the target container can restore the application process based on the difference file.

[0115] The target container 73 is used to receive the difference file, which contains the application process memory snapshot and the file system update file. The backup file of the application process memory snapshot is fragmented to generate multiple first backup sub-files. Multiple threads are used to decompress the multiple first backup sub-files to generate multiple second backup sub-files. Based on the multiple second backup sub-files and the file system update file, the application process is restored.

[0116] Cloud Disk 75 is used to receive the difference files sent by the source container and send the difference files to the target container.

[0117] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section of this specification.

[0118] The program product used to implement the above-described method in the exemplary embodiments of this disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0119] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0120] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0121] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0122] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0123] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described application expansion method is also provided.

[0124] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as “circuits,” “modules,” or “systems.”

[0125] The following reference Figure 8 To describe an electronic device 800 according to this embodiment of the present invention. Figure 8 The electronic device 800 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0126] like Figure 8 As shown, the electronic device 800 is presented in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processing unit 810, at least one storage unit 820, a bus 830 connecting different system components (including storage unit 820 and processing unit 810), and a display unit 840.

[0127] The storage unit stores program code, which can be executed by the processing unit 810 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 810 can perform actions such as... Figure 1 Steps S12 to S18 shown or as described Figure 2 Steps S22 to S26 are shown in the diagram.

[0128] Storage unit 820 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include a read-only memory (ROM) 8203.

[0129] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0130] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0131] Electronic device 800 can also communicate with one or more external devices 900 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 800, and / or with any device that enables electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 850. Furthermore, electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 860. As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0132] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0133] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0134] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0135] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0136] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. An application expansion method, characterized in that, Applied to the source container, including: The application process's memory image file is backed up using the dump backup method, generating a backup file, which is then split into multiple backup sub-files. Multiple threads are used to compress the multiple backup sub-files to generate a memory snapshot of the application process; Obtain a file system snapshot before the application process starts and a file system snapshot after the application process starts. Compare the file system snapshot before the application process starts with the file system snapshot after the application process starts to determine the updated files in the file system. Based on the memory snapshot of the application process and the update files of the file system, a difference file is generated and sent so that the target container can restore the application process based on the difference file.

2. The application expansion method according to claim 1, characterized in that, include: After the application process starts, control the application process to stop running in order to obtain a file system snapshot after the application process starts.

3. The application expansion method according to claim 1, characterized in that, The file system snapshot before the application process starts is compared with the file system snapshot after the application process starts to determine the updated files in the file system, including: Obtain the file parameters of the file system snapshot before the application process starts and the file parameters of the file system snapshot after the application process starts. The file parameters are the status information of each file in the file system snapshot. Based on the file parameters of the file system snapshot before the application process starts and the file parameters of the file system snapshot after the application process starts, the contents of each file in the file system snapshot are compared one by one to determine the updated file system file.

4. The application expansion method according to claim 1, characterized in that, Before generating a memory snapshot of the application process, the following is also included: Clear the middleware state of the application process so that the restored application process can connect with the middleware and control the operation of the restored application process.

5. The application expansion method according to claim 2, characterized in that, After sending the difference file to the target container, the process also includes: After sending the difference file, control the application process to run.

6. An application expansion method, characterized in that, Applied to the target container, including: The system receives a difference file, which contains an application process memory snapshot and a file system update file. The application process memory snapshot is generated by the source container backing up the application process's memory image file using a dump backup method, splitting the backup file into multiple backup sub-files, and compressing the multiple backup sub-files using multiple threads. The file system update file is determined by the source container by comparing the file system snapshot obtained before the application process starts with the file system snapshot obtained after the application process starts. The backup file of the application process memory snapshot is segmented to generate multiple first backup sub-files, and multiple threads are used to decompress the multiple first backup sub-files to generate multiple second backup sub-files; The application process is restored based on the multiple second backup sub-files and the updated files of the file system.

7. The application expansion method according to claim 6, characterized in that, After resuming the application process, it also includes: The control SDK calls the interface of the recovery instance to implement middleware recovery, and the recovery instance is used to implement network connectivity; Restore the middleware state so that the restored application process can continue running as it did before the source container cleaned up the middleware state.

8. An application expansion system, characterized in that, include: The source container is used to back up the memory image file of the application process based on the dump backup method, generate a backup file, and split the backup file into multiple backup sub-files. Multiple threads are used to compress the multiple backup sub-files to generate a memory snapshot of the application process. The system snapshot before the application process starts and the system snapshot after the application process starts are obtained. The system snapshot before the application process starts and the system snapshot after the application process starts are compared to determine the updated file of the file system. Based on the memory snapshot of the process and the updated file system file, a difference file is generated and sent. The target container is used to receive the difference file, which contains a memory snapshot of the application process and an update file of the file system. The backup file of the application process memory snapshot is fragmented to generate multiple first backup sub-files. Multiple threads are used to decompress the multiple first backup sub-files to generate multiple second backup sub-files. Based on the multiple second backup sub-files and the update file of the file system, the application process is restored.

9. The application expansion system according to claim 8, characterized in that, include: The cloud disk is used to receive the difference file sent by the source container and send the difference file to the target container.

10. An application expansion device, characterized in that, include: The generation module is used to back up the memory image file of the application process based on the dump backup method, generate a backup file, and split the backup file into multiple backup sub-files; The generation module is also used to compress the multiple backup sub-files using multiple threads to generate a memory snapshot of the application process; The determination module is used to obtain a file system snapshot before the application process starts and a file system snapshot after the application process starts, compare the file system snapshot before the application process starts with the file system snapshot after the application process starts, and determine the updated files in the file system. The sending module is used to generate a difference file based on the memory snapshot of the application process and the update files of the file system, and send the difference file so that the target container can restore the application process based on the difference file.

11. An application expansion device, characterized in that, include: A receiving module is used to receive a difference file, which contains a memory snapshot of the application process and an update file of the file system. The application process memory snapshot is generated by the source container backing up the memory image file of the application process using a dump backup method, and the backup file is split into multiple backup sub-files. Multiple threads are used to compress the multiple backup sub-files. The update file of the file system is determined by the source container by comparing the file system snapshot obtained before the application process starts with the file system snapshot obtained after the application process starts. The generation module is used to segment the backup file of the memory snapshot to generate multiple first backup sub-files, and to decompress the multiple first backup sub-files using multiple threads to generate multiple second backup sub-files; The recovery module is used to restore the application process based on the plurality of second backup sub-files and the updated files of the file system.

12. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the application expansion method according to any one of claims 1 to 7.

13. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the application scaling method of any one of claims 1 to 7 by executing the executable instructions.

Citation Information

Patent Citations

  • Internet-based difference remote file backup and recovery system

    CN107506265A

  • Log file compression method and decompression method, electronic equipment and readable storage medium

    CN107977442A

  • Application program processing method and device

    CN111435302A