Data migration method and apparatus, and electronic device and storage medium
By dividing the data transfer request into multiple data sub-segments and using multi-threads for parallel processing, the problem of low efficiency of user-mode and kernel-mode data migration in the existing technology is solved, and efficient data migration and erasure calculation are achieved.
Patent Information
- Application Number
- PCT/CN2024/076968
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-21
- Filing Date
- 2024-02-08
- Publication Date
- 2024-08-29
AI Technical Summary
In the existing technology, data migration efficiency between user mode and kernel mode is low, and single-thread completion cannot utilize the full bandwidth of the memory, resulting in low data migration efficiency.
By dividing the data transfer request into multiple data sub-segments, and using multiple data migration threads to perform data migration in parallel, a data migration thread pool and an erasure redundant calculation thread pool are created to process data between user mode and kernel mode respectively. Migrate and eradicate redundant calculations.
It improves the efficiency of data migration between user mode and kernel mode, realizes multi-threaded parallel processing, and improves the efficiency of data migration and erasure calculation.
Smart Images

Figure CN2024076968_29082024_PF_FP_ABST
Abstract
Description
Data migration method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on February 21, 2023, with application number 202310140582.2, and application name “A data migration method, device, electronic device and storage medium”, all contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of storage technology, and more specifically, to a data migration method, device, electronic device, and non-volatile readable storage medium. Background Art
[0004] Single-stream storage is a demanding application scenario in the storage field, primarily suited for high-performance computing, especially data writing applications such as satellites, astronomical telescopes, and cryo-electron microscopes. As data volumes from satellites and astronomical telescopes increase, distributed storage clients are required to provide higher reception performance, specifically single-stream performance.
[0005] Distributed storage is generally defined as a storage system composed of multiple storage nodes interconnected via a network, creating a unified namespace that can be accessed concurrently by clients. Distributed storage achieves single-threaded performance by striping files and sending them concurrently to multiple nodes for parallel processing.
[0006] As shown in Figure 1, Figure 1 is a structural diagram of a data migration system in the prior art. In the prior art, a single thread in an application process accesses storage by first calling the kernel's VFS (virtual file system) through the standard file library API (Application Programming Interface), then calling the kernel-mode client that enters the distributed storage, and then implementing data copying to achieve data migration between user mode and kernel mode, so that the kernel-mode client can access the application data. For data migration and copying between user mode and kernel mode, the application initiates a system call, enters the API interface of the VFS file system, passes the data address of the user-mode process to the kernel-mode distributed storage client, and then completes the data migration through the user-mode and kernel-mode copy functions, achieving the transfer of stored data from the user process to the kernel cache. After the user process passes the data cache to the kernel, it performs erasure striping calculation, stripes the data cache, and then distributes it to the back-end storage system.
[0007] That is, in the existing technology, the migration of user-mode to kernel-mode data in the system call can only be completed by a single thread, which cannot utilize the full bandwidth of the memory and can only utilize the copy performance of a single core. The single-threaded IO (Input / Output) process relies on the system call initiated by the user process and is related to the user's thread. As a result, the migration data can only be executed serially, and the data migration efficiency is low.
[0008] Therefore, how to improve the efficiency of data migration between user state and kernel state is a technical problem that needs to be solved by those skilled in the art.
[0009] Summary of the Invention
[0010] The purpose of this application is to provide a data migration method, device, electronic device and computer non-volatile readable storage medium, which improve the efficiency of data migration between user state and kernel state.
[0011] To achieve the above objectives, this application provides a data migration method, including:
[0012] Receive data transmission requests sent by user-mode applications;
[0013] Dividing the read and write data corresponding to the data transmission request into multiple data sub-segments;
[0014] Multiple data migration threads are used to migrate multiple data sub-segments in parallel between the user-mode application and the kernel-mode cache; wherein the data migration threads correspond one to one to the data sub-segments.
[0015] Receiving a data transmission request sent by a user-mode application includes:
[0016] Receives data transfer requests sent by user-mode applications through the virtual file system interface.
[0017] Before migrating multiple data sub-segments between a user-state application and a kernel-state cache using multiple data migration threads in parallel, the method further includes:
[0018] A data migration thread pool is created; wherein the data migration thread pool includes multiple data migration threads.
[0019] The read and write data corresponding to the data transmission request is divided into multiple data sub-segments, including:
[0020] The read and write data corresponding to the data transmission request is divided into a plurality of data sub-segments in sequence based on a preset length.
[0021] The method utilizes multiple data migration threads to concurrently migrate multiple data sub-segments between a user-mode application and a kernel-mode cache, including:
[0022] Creating corresponding multiple data migration tasks based on address information of multiple data sub-segments;
[0023] Multiple data migration tasks are executed in parallel using multiple data migration threads to achieve data migration of multiple data sub-segments between user-mode applications and kernel-mode caches.
[0024] The address information of the data sub-segment includes the memory management unit corresponding to the application, the length of the data sub-segment, the source address and the destination address.
[0025] Among them, multiple data migration tasks are executed in parallel using multiple data migration threads to achieve data migration of multiple data sub-segments between user-state applications and kernel-state caches, including:
[0026] Switching multiple data migration threads to the user state address space based on the memory management unit corresponding to the application;
[0027] Multiple data migration threads are used to migrate multiple data sub-segments between a user-state application and a kernel-state cache based on source addresses and destination addresses of the corresponding multiple data sub-segments.
[0028] Before creating corresponding multiple data migration tasks based on the address information of the multiple data sub-segments, the method further includes:
[0029] Dividing the cache of the application into a plurality of first segments based on a preset length, and determining source addresses of corresponding plurality of data sub-segments based on start addresses of the plurality of first segments;
[0030] The kernel-mode cache is divided into a plurality of second segments based on a preset length, and the destination addresses of the corresponding plurality of data sub-segments are determined based on the start addresses of the plurality of second segments.
[0031] Among them, multiple data migration tasks are executed in parallel using multiple data migration threads to achieve data migration of multiple data sub-segments between user-state applications and kernel-state caches, including:
[0032] Multiple data migration tasks are executed in parallel using multiple data migration threads to migrate multiple data sub-segments from a user-mode application to a kernel-mode cache.
[0033] Before creating corresponding multiple data migration tasks based on the address information of the multiple data sub-segments, the method further includes:
[0034] Dividing the kernel-mode cache into a plurality of second segments based on a preset length, and determining source addresses of the corresponding plurality of data sub-segments based on start addresses of the plurality of second segments;
[0035] The cache of the application is divided into a plurality of first segments based on a preset length, and the destination addresses of the corresponding plurality of data sub-segments are determined based on the start addresses of the plurality of first segments.
[0036] Among them, multiple data migration tasks are executed in parallel using multiple data migration threads to achieve data migration of multiple data sub-segments between user-state applications and kernel-state caches, including:
[0037] Multiple data migration tasks are executed in parallel using multiple data migration threads to migrate multiple data sub-segments from a kernel-mode cache to a user-mode application.
[0038] After migrating multiple data sub-segments between a user-state application and a kernel-state cache using multiple data migration threads in parallel, the method further includes:
[0039] Divide the migrated data into multiple data stripes;
[0040] Multiple erasure redundancy calculation threads are used to perform erasure redundancy calculation on multiple data stripes in parallel; wherein the erasure redundancy calculation threads correspond one to one to the data stripes.
[0041] Before performing erasure redundancy calculation on multiple data stripes in parallel using multiple erasure redundancy calculation threads, the method further includes:
[0042] An erasure redundancy calculation thread pool is created; wherein the erasure redundancy calculation thread pool includes multiple erasure redundancy calculation threads.
[0043] The migrated data is divided into multiple data stripes, including:
[0044] The migrated data is divided into multiple data stripes in sequence based on the preset length.
[0045] The erasure redundancy calculation is performed on multiple data stripes in parallel using multiple erasure redundancy calculation threads, including:
[0046] Create corresponding multiple erasure redundancy calculation tasks based on the input cache addresses and output cache addresses of multiple data stripes;
[0047] Multiple erasure redundancy calculation threads are used to perform erasure redundancy calculations on multiple data stripes in parallel.
[0048] Before dividing the migrated data into multiple data stripes, the following steps are also included:
[0049] Determine whether all data migration threads have been completed;
[0050] If all data migration threads are executed completely, the step of dividing the migrated data into multiple data stripes is executed.
[0051] After performing erasure redundancy calculations on multiple data stripes in parallel using multiple erasure redundancy calculation threads, the method further includes:
[0052] Determine whether all erasure redundancy calculation threads have been completed;
[0053] If all erasure redundancy calculation threads are completed, the data after erasure redundancy calculation is sent to the storage system.
[0054] To achieve the above objectives, the present application provides a data migration device, comprising:
[0055] A receiving module is configured to receive a data transmission request sent by a user-mode application;
[0056] A first dividing module is configured to divide the read and write data corresponding to the data transmission request into a plurality of data sub-segments;
[0057] The migration module is configured to utilize multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-mode application and the kernel-mode cache; wherein the data migration threads correspond one to one to the data sub-segments.
[0058] To achieve the above objectives, the present application provides an electronic device, comprising:
[0059] a memory configured to store a computer program;
[0060] The processor is configured to implement the steps of the above-mentioned data migration method when executing the computer program.
[0061] To achieve the above objectives, the present application provides a computer non-volatile readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above data migration method are implemented.
[0062] From the above scheme, it can be seen that a data migration method provided by the present application includes: receiving a data transmission request sent by a user-state application; dividing the read and write data corresponding to the data transmission request into multiple data sub-segments; using multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-state application and the kernel-state cache; wherein the data migration threads correspond one-to-one to the data sub-segments.
[0063] The data migration method provided by this application divides the read and write data to be migrated between user mode and kernel mode into multiple data sub-segments, distributes them to multiple data migration threads, and uses these multiple data migration threads to perform data migration of the multiple data sub-segments in parallel, thereby improving the efficiency of data migration between user mode and kernel mode. This application also discloses a data migration device, an electronic device, and a non-volatile computer-readable storage medium, which can also achieve the above-mentioned technical effects.
[0064] It should be understood that the foregoing general description and the following detailed description are merely illustrative and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The drawings are used to provide a further understanding of the present disclosure and constitute part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure, but do not constitute a limitation of the present disclosure. In the drawings:
[0066] FIG1 is a structural diagram of a data migration system in the prior art;
[0067] FIG2 is a flow chart showing a data migration method according to an exemplary embodiment;
[0068] FIG3 is a flow chart showing another data migration method according to an exemplary embodiment;
[0069] FIG4 is a structural diagram of a data migration system according to an exemplary embodiment;
[0070] FIG5 is a structural diagram of another data migration system according to an exemplary embodiment;
[0071] FIG6 is a structural diagram of a data migration device according to an exemplary embodiment;
[0072] Fig. 7 is a structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0073] 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 a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0074] The embodiment of the present application discloses a data migration method, which improves the efficiency of data migration between user state and kernel state.
[0075] 2 is a flowchart of a data migration method according to an exemplary embodiment. As shown in FIG2 , the method includes:
[0076] S101: receiving a data transmission request sent by a user-mode application;
[0077] The execution subject of this embodiment is a kernel-mode client, which refers to a distributed storage client deployed in the user mode of the client host OS (Operating System) to achieve interconnected access between the client host and the distributed storage system. In a specific implementation, a user-mode application initiates a data transmission request to the storage system, which is received by the kernel-mode client. Kernel mode refers to the kernel operating state of the computing processor. Modern operating systems such as Linux and Windows all have kernel mode, which is used to run the operating system's management processes, resource scheduling, memory management, and other processes. User mode refers to the user operating state of the computing processor. Modern operating systems such as Linux and Windows all have user mode, which is used to run user processes.
[0078] As an optional implementation, receiving a data transmission request from a user-mode application includes receiving the data transmission request from the user-mode application through a virtual file system interface. In a specific implementation, the data transmission request enters the VFS system interface through a standard software library and an operating system system call. The VFS implements the operating system's file interface, and various file systems implement statistical interface docking. The VFS system interface calls a processing function of the distributed file system, optionally performing general file processing, which may include file processing operations such as metadata and locks.
[0079] S102: Divide the read / write data corresponding to the data transmission request into multiple data sub-segments;
[0080] In this step, the read / write data corresponding to the data transmission request is divided into a plurality of data sub-segments. As an optional embodiment, dividing the read / write data corresponding to the data transmission request into a plurality of data sub-segments includes: dividing the read / write data corresponding to the data transmission request into a plurality of data sub-segments in sequence based on a preset length. In a specific implementation, the read / write data is divided in sequence into a plurality of data sub-segments of a preset length.
[0081] S103: Using multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-mode application and the kernel-mode cache; wherein the data migration threads correspond to the data sub-segments on a one-to-one basis.
[0082] In this step, multiple data subsegments are distributed to multiple data migration threads, and data migration of multiple data subsegments is performed in parallel using multiple data migration threads. The number of data migration threads is the same as the number of data subsegments, and the data migration threads correspond to the data subsegments one by one.
[0083] As an optional embodiment, before using multiple data migration threads to concurrently migrate multiple data subsegments between a user-mode application and a kernel-mode cache, the method further includes: creating a data migration thread pool; wherein the data migration thread pool includes multiple data migration threads. In a specific implementation, a data migration thread pool including multiple data migration threads is created, each data migration thread being used to migrate data for a corresponding data subsegment.
[0084] As an optional implementation, multiple data migration threads are used in parallel to migrate multiple data sub-segments between user-state applications and kernel-state caches, including: creating corresponding multiple data migration tasks based on address information of multiple data sub-segments; and using multiple data migration threads to execute multiple data migration tasks in parallel to achieve data migration of multiple data sub-segments between user-state applications and kernel-state caches.
[0085] It is understandable that in the prior art, the executing thread is still a user-mode process; it's just that the CPU (central processing unit) execution state has switched, enabling the use of data migration instructions to implement data migration instructions between user mode and kernel mode. To address the issue of kernel-mode threads being unable to arbitrarily access the user-mode address space, this embodiment encapsulates the address information of a data subsegment into a data migration task during a system call. The address information of the data subsegment may include the memory management unit (MMU) corresponding to the application, the length of the data subsegment, the source address, and the destination address. The MMU is responsible for mapping and managing the address space of the user-mode process and physical memory.
[0086] As an optional implementation, multiple data migration tasks are executed in parallel using multiple data migration threads to achieve data migration of multiple data sub-segments between user-state applications and kernel-state caches, including: switching multiple data migration threads to the user-state address space based on the memory management unit corresponding to the application; and using multiple data migration threads to migrate multiple data sub-segments between the user-state application and kernel-state caches based on the source addresses and destination addresses of the corresponding multiple data sub-segments.
[0087] It should be noted that since the memory data in a single thread in a user-state application cannot be accessed by multiple threads in a kernel-state client, that is, the data of a single thread cannot be accessed by multiple threads by default, in this embodiment, multiple threads in the kernel-state client are able to access the space in the application at the same time, that is, the MMU (memory management unit), so that the kernel-state client can access the data in the user-state application.
[0088] In practice, data migration tasks are assigned to different worker threads in the kernel-mode multi-thread pool. Each worker thread, based on the data migration task, switches to the MMU of the designated user-mode process and executes the data migration instructions according to the segmented source and destination addresses. Upon completion, the thread returns to the next migration task. When all segmented data migration tasks for a cache are complete, the system calls the data migration completion notification and returns to the user-mode process.
[0089] The kernel-mode and user-mode data copy migration tasks are distributed to the migration worker thread. The kernel-mode worker thread switches dynamically to the MMU of the user-mode process according to the data copy task to implement data copy migration and solve the problem that the kernel-mode process cannot access the address space of the specified user-mode process.
[0090] When copying data from user mode to kernel mode, that is, when the data transfer request in this embodiment is a write request, before creating corresponding multiple data migration tasks based on the address information of multiple data sub-segments, the method further includes: dividing the application's cache into multiple first segments based on a preset length, and determining the source addresses of the corresponding multiple data sub-segments based on the starting addresses of the multiple first segments; dividing the kernel mode cache into multiple second segments based on a preset length, and determining the destination addresses of the corresponding multiple data sub-segments based on the starting addresses of the multiple second segments. Accordingly, multiple data migration tasks are executed in parallel using multiple data migration threads to achieve data migration of multiple data sub-segments between the user mode application and the kernel mode cache, including: using multiple data migration threads to execute multiple data migration tasks in parallel to migrate multiple data sub-segments from the user mode application to the kernel mode cache.
[0091] In a specific implementation, when copying data from user state to kernel state, the cache of the user process is divided into multiple segments according to a fixed size (i.e., a preset length) to obtain a source address list of n segment addresses of the source starting address; the kernel state cache is divided into multiple segments of the same preset length to obtain a destination address list of n segment addresses of the target starting address; the user process MMU, the user state segment source starting address, the segment cache length, and the kernel state segment target address are combined into n data copy tasks and distributed to the data migration work thread.
[0092] When copying data from kernel mode to user mode, that is, when the data transfer request in this embodiment is a read request, before creating corresponding multiple data migration tasks based on the address information of multiple data sub-segments, the method further includes: dividing the kernel mode cache into multiple second segments based on a preset length, and determining the source addresses of the corresponding multiple data sub-segments based on the starting addresses of the multiple second segments; dividing the application's cache into multiple first segments based on a preset length, and determining the destination addresses of the corresponding multiple data sub-segments based on the starting addresses of the multiple first segments. Accordingly, multiple data migration tasks are executed in parallel using multiple data migration threads to achieve data migration of multiple data sub-segments between the user mode application and the kernel mode cache, including: using multiple data migration threads to execute multiple data migration tasks in parallel to migrate multiple data sub-segments from the kernel mode cache to the user mode application.
[0093] In a specific implementation, when copying data from kernel state to user state, the cache of the user process is divided into multiple segments according to a fixed size (i.e., a preset length) to obtain a source address list of n segment addresses of the destination starting address; the kernel state cache with the same cache length is divided into multiple segments to obtain a destination address list of n segment addresses of the source starting address; the user process MMU, the user state segment destination starting address, the segment cache length, and the kernel state segment source address are combined into n data copy tasks and distributed to the data migration work thread.
[0094] The data migration method provided in the embodiment of the present application divides the read and write data that needs to be migrated between user state and kernel state into multiple data sub-segments, distributes them to multiple data migration threads, and uses multiple data migration threads to execute data migration of multiple data sub-segments in parallel, thereby improving the data migration efficiency between user state and kernel state.
[0095] The embodiment of this application discloses a data migration method, and this embodiment further illustrates the technical solution. Optional:
[0096] Referring to FIG3 , a flow chart of another data migration method according to an exemplary embodiment is shown. As shown in FIG3 , the method includes:
[0097] S201: Receive a data transmission request sent by a user-mode application;
[0098] S202: Divide the read / write data corresponding to the data transmission request into a plurality of data sub-segments;
[0099] S203: Using multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-mode application and the kernel-mode cache; wherein the data migration threads correspond one to one to the data sub-segments;
[0100] In a specific implementation, it is determined whether all data migration threads have been executed completely; if all data migration threads have been executed completely, the process proceeds to S204.
[0101] S204: Divide the migrated data into multiple data stripes;
[0102] In this step, the data cache migrated to kernel mode is subdivided into multiple data stripes. As an optional implementation, dividing the migrated data into multiple data stripes includes: dividing the migrated data into multiple data stripes in sequence based on a preset length. In a specific implementation, the migrated data is divided into multiple data stripes of preset length in sequence. Data striping refers to dividing a file into many small data blocks, i.e., data striping, and then distributing the data stripes to each storage node of the distributed storage.
[0103] S205: Perform erasure redundancy calculation on multiple data stripes in parallel using multiple erasure redundancy calculation threads; wherein the erasure redundancy calculation threads correspond to the data stripes one-to-one.
[0104] In this step, multiple data stripes are distributed to different erasure redundancy calculation threads for parallel erasure redundancy calculation. The number of erasure redundancy calculation threads is the same as the number of data stripes, and there is a one-to-one correspondence between erasure redundancy calculation threads and data stripes. Erasure coding (EC) can be used here. EC is a data protection method that divides data into fragments, expands and encodes redundant data blocks, and stores them in different locations, such as disks, storage nodes, or other geographical locations.
[0105] As an optional implementation, before using multiple erasure redundancy calculation threads to perform erasure redundancy calculation on multiple data stripes in parallel, the method further includes: creating an erasure redundancy calculation thread pool; wherein the erasure redundancy calculation thread pool includes multiple erasure redundancy calculation threads. In a specific implementation, an erasure redundancy calculation thread pool including multiple erasure redundancy calculation threads is created, and each erasure redundancy calculation thread is used to perform erasure redundancy calculation on a corresponding data stripe.
[0106] As an optional implementation, multiple erasure redundancy calculation threads are used to perform erasure redundancy calculation on multiple data stripes in parallel, including: creating corresponding multiple erasure redundancy calculation tasks based on the input cache addresses and output cache addresses of the multiple data stripes; and using multiple erasure redundancy calculation threads to perform erasure redundancy calculation on the multiple data stripes in parallel.
[0107] In a specific implementation, the data cache to be calculated is divided into m segments according to the minimum block size of the erasure calculation, obtaining m data segments and m input cache addresses; the data blocks and redundant blocks of the erasure calculation cache are divided according to the m segments, obtaining m groups of output cache addresses; the m input cache addresses and the m groups of output cache addresses are sequentially combined into computing tasks and distributed to different erasure and redundancy computing threads for computing.
[0108] Each erasure calculation task is assigned to a worker thread in the erasure calculation thread pool. Each erasure calculation thread in the erasure calculation thread pool independently performs erasure calculations for a data stripe, reading the data at the input address, performing erasure calculations, obtaining data blocks and redundant blocks, and outputting these blocks to the output results specified by the calculation task, completing an erasure calculation task. Multiple erasure task threads associated with a data cache execute in parallel. When all associated erasure calculation tasks are completed, erasure calculations for the entire data cache are complete.
[0109] Optionally, after performing erasure redundancy calculation on multiple data stripes in parallel using multiple erasure redundancy calculation threads, the method further includes: determining whether all erasure redundancy calculation threads have been fully executed; if all erasure redundancy calculation threads have been fully executed, sending the data after the erasure redundancy calculation to the storage system.
[0110] As can be seen, this embodiment implements parallel data copy and migration between user and kernel states, resolving the issue of kernel-state threads being unable to access the address space of user-state application processes. It also distributes cached data in segments to multiple kernel threads, enabling concurrent execution of data migration instructions. This embodiment also implements parallel erasure calculations for the data cache, resolving the issue of serial calculations in single-threaded system calls. It also distributes cached data in segments to multiple kernel threads, enabling concurrent execution of erasure calculation instructions.
[0111] The following describes an optional application embodiment provided by this application. Referring to FIG4 , FIG4 is a structural diagram of a data migration system according to an exemplary embodiment. As shown in FIG4 , the data migration system includes user state and kernel state. The user state includes application processes, and the kernel state includes a VFS interface and a kernel client. The data migration method specifically includes the following steps:
[0112] Step 1: The user-mode application process initiates a data transfer request to the storage system.
[0113] Step 2: The data transfer request passes through the standard software library, the operating system system call, and enters the VFS system interface;
[0114] Step 3: VFS system interface, calling the processing function of the distributed file system;
[0115] Step 4: Complete general file processing, metadata, locks, etc.
[0116] Step 5: Data copy migration is changed from serial to parallel. In the existing technology, the single thread of the user-state application process calls the distributed storage client through the system, and the system default data copy migration must be in the address space of the user-state process, that is, the caller's thread or process, to perform address translation and copying.
[0117] Referring to FIG. 5 , FIG. 5 is a structural diagram of another data migration system according to an exemplary embodiment. Step 5 provided in this embodiment specifically includes the following steps:
[0118] 5.1: First, initialize multiple kernel thread pools to form the copy migration thread pool;
[0119] 5.2: Split the user-mode data cache into multiple data sub-segments in sequence. Each sub-segment is treated as a copy migration task.
[0120] 5.3: Distribute the copy migration task to the thread pool;
[0121] 5.4: Each worker thread of the kernel thread pool switches to the user state address space;
[0122] The kernel worker thread switches to the migration task from the address space of a different caller process;
[0123] 5.5: Each kernel worker thread independently completes data copy and migration;
[0124] 5.6: All cache blocks have completed data copying, and the copying is completed;
[0125] Step 6: Erasure correction calculations are performed in parallel. In the prior art, user application calls are single-threaded. This embodiment subdivides the data cache migrated to kernel state into multiple data stripes. Each data stripe is treated as a computing task and distributed to the computing thread pool. A worker thread in the thread pool independently performs the calculation of a data stripe. The specific steps include:
[0126] 6.1: First, initialize multiple kernel thread pools to form the erasure calculation thread pool.
[0127] 6.2: Divide the cached data into small data blocks according to the erasure stripe size, and form computing tasks; a group of computing tasks is responsible for performing erasure calculations on one data block.
[0128] 6.3: Distribute computing tasks to different worker threads in the erasure computing thread pool;
[0129] 6.4: When a set of computing tasks for a data block are completed, the erasure calculation of the entire data block is completed.
[0130] This embodiment changes the data copy migration from serial to parallel, solving the problem that kernel-mode and user-mode data migration cannot be executed in parallel. By dynamically switching the kernel client MMU, it solves the problem that the kernel-mode thread pool cannot migrate user-mode process data. By executing cache area segments concurrently, it solves the problem of slow single-threaded erasure calculation, thereby improving the single-threaded performance of the application when using the storage client.
[0131] A data migration device provided in an embodiment of the present application is introduced below. The data migration device described below and the data migration method described above can be referenced to each other.
[0132] 6 , which is a structural diagram of a data migration device according to an exemplary embodiment, includes:
[0133] The receiving module 601 is configured to receive a data transmission request sent by a user-mode application;
[0134] A first division module 602 is configured to divide the read / write data corresponding to the data transmission request into a plurality of data sub-segments;
[0135] The migration module 603 is configured to utilize multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-mode application and the kernel-mode cache; wherein the data migration threads correspond one to one to the data sub-segments.
[0136] The data migration device provided in the embodiment of the present application divides the read and write data that needs to be migrated between the user state and the kernel state into multiple data sub-segments, distributes them to multiple data migration threads, and uses multiple data migration threads to execute the data migration of multiple data sub-segments in parallel, thereby improving the data migration efficiency between the user state and the kernel state.
[0137] Based on the above embodiment, as an optional implementation manner, the receiving module 601 is specifically configured to: receive a data transmission request sent by a user-mode application through a virtual file system interface.
[0138] Based on the above embodiment, as an optional implementation manner, the following is further included:
[0139] The first creation module is configured to create a data migration thread pool; wherein the data migration thread pool includes multiple data migration threads.
[0140] Based on the above embodiment, as an optional implementation manner, the first division module 602 is specifically configured to: divide the read and write data corresponding to the data transmission request into multiple data sub-segments in sequence based on a preset length.
[0141] Based on the above embodiment, as an optional implementation, the migration module 603 includes:
[0142] A first creating unit is configured to create corresponding multiple data migration tasks based on address information of multiple data sub-segments;
[0143] The first execution unit is configured to utilize multiple data migration threads to execute multiple data migration tasks in parallel, so as to realize data migration of multiple data sub-segments between a user-mode application and a kernel-mode cache.
[0144] Based on the above embodiment, as an optional implementation manner, the address information of the data sub-segment includes the memory management unit corresponding to the application, the length of the data sub-segment, the source address and the destination address.
[0145] Based on the above embodiment, as an optional implementation method, the first execution unit is specifically configured to: switch multiple data migration threads to the user-state address space based on the memory management unit corresponding to the application; use multiple data migration threads to migrate multiple data sub-segments between the user-state application and the kernel-state cache based on the source addresses and destination addresses of the corresponding multiple data sub-segments.
[0146] Based on the above embodiment, as an optional implementation, the migration module 603 further includes:
[0147] The first partitioning unit is configured to partition the cache of the application into a plurality of first segments based on a preset length, and determine the source addresses of the corresponding plurality of data sub-segments based on the starting addresses of the plurality of first segments; and to partition the cache of the kernel state into a plurality of second segments based on the preset length, and determine the destination addresses of the corresponding plurality of data sub-segments based on the starting addresses of the plurality of second segments.
[0148] Based on the above embodiment, as an optional implementation, the first execution unit is specifically configured to: use multiple data migration threads to execute multiple data migration tasks in parallel to migrate multiple data sub-segments from user-state applications to kernel-state cache.
[0149] Based on the above embodiment, as an optional implementation, the migration module 603 further includes:
[0150] The second partitioning unit is configured to partition the kernel-mode cache into a plurality of second segments based on a preset length, and determine the source addresses of the corresponding plurality of data sub-segments based on the starting addresses of the plurality of second segments; and to partition the application's cache into a plurality of first segments based on a preset length, and determine the destination addresses of the corresponding plurality of data sub-segments based on the starting addresses of the plurality of first segments.
[0151] Based on the above embodiment, as an optional implementation, the first execution unit is specifically configured to: use multiple data migration threads to execute multiple data migration tasks in parallel to migrate multiple data sub-segments from the kernel-state cache to the user-state application.
[0152] Based on the above embodiment, as an optional implementation manner, the following is further included:
[0153] a second partitioning module configured to partition the migrated data into a plurality of data stripes;
[0154] The computing module is configured to perform erasure redundancy calculation on multiple data stripes in parallel using multiple erasure redundancy calculation threads; wherein the erasure redundancy calculation threads correspond to the data stripes one by one.
[0155] Based on the above embodiment, as an optional implementation manner, the following is further included:
[0156] The second creation module is configured to create an erasure redundancy calculation thread pool; wherein the erasure redundancy calculation thread pool includes multiple erasure redundancy calculation threads.
[0157] Based on the above embodiment, as an optional implementation manner, the second division module is specifically configured to: divide the migrated data into multiple data stripes in sequence based on a preset length.
[0158] Based on the above embodiment, as an optional implementation method, the computing module is specifically configured to: create corresponding multiple erasure redundancy calculation tasks based on the input cache addresses and output cache addresses of multiple data stripes; and use multiple erasure redundancy calculation threads to perform erasure redundancy calculation on multiple data stripes in parallel.
[0159] Based on the above embodiment, as an optional implementation manner, the following is further included:
[0160] The first judgment module is configured to judge whether all data migration threads are completely executed; if all data migration threads are completely executed, the work flow of the second division module is started.
[0161] Based on the above embodiment, as an optional implementation manner, the following is further included:
[0162] The second judgment module is configured to judge whether all erasure redundancy calculation threads have been executed; if all erasure redundancy calculation threads have been executed, the workflow of the sending module is started;
[0163] The sending module is configured to send the data after erasure redundancy calculation to the storage system.
[0164] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0165] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an electronic device. FIG7 is a structural diagram of an electronic device according to an exemplary embodiment. As shown in FIG7 , the electronic device includes:
[0166] Communication interface 1, capable of exchanging information with other devices such as network devices;
[0167] The processor 2 is connected to the communication interface 1 to implement information exchange with other devices and is configured to execute the data migration method provided by one or more of the above technical solutions when running a computer program. The computer program is stored in the memory 3.
[0168] Of course, in actual applications, the various components in the electronic device are coupled together via bus system 4. It will be appreciated that bus system 4 is configured to enable communication between these components. In addition to a data bus, bus system 4 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in FIG7 , all of these buses are labeled as bus system 4.
[0169] The memory 3 in the embodiment of the present application is configured to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program for operating on the electronic device.
[0170] It is understood that the memory 3 can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a magnetic disk memory or a magnetic tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memory 3 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.
[0171] The methods disclosed in the above embodiments of the present application can be applied to processor 2 or implemented by processor 2. Processor 2 may 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 processor 2 or instructions in software form. The above processor 2 may be a general-purpose processor, a DSP (Digital Signal Processing), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 2 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. 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 by a combination of hardware and software modules in the decoding processor. The software module can be located in a non-volatile readable storage medium, which is located in memory 3. Processor 2 reads the program in memory 3 and completes the steps of the above method in combination with its hardware.
[0172] When the processor 2 executes the program, the corresponding processes in each method of the embodiment of the present application are implemented. For the sake of brevity, they are not repeated here.
[0173] In an exemplary embodiment, the present application also provides a non-volatile readable storage medium, namely, a computer non-volatile readable storage medium, for example, including a memory 3 storing a computer program. The computer program can be executed by a processor 2 to perform the aforementioned method steps. The computer non-volatile readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, CD-ROM, etc.
[0174] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer non-volatile readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned non-volatile readable storage medium includes: mobile storage devices, ROM, RAM, magnetic disks or optical disks, etc. Various media that can store program codes.
[0175] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer non-volatile readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a non-volatile readable storage medium and includes a number of instructions for enabling an electronic device (which can be a personal computer, server, network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned non-volatile readable storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0176] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A data migration method, It is characterized in that include: Receive data transmission requests sent by user-mode applications; Dividing the read and write data corresponding to the data transmission request into a plurality of data sub-segments; A plurality of data migration threads are used to perform data migration between the user-mode application and the kernel-mode cache on the plurality of data sub-segments in parallel; wherein the data migration threads correspond one to one to the data sub-segments.
2. According to the data migration method of claim 1, It is characterized in that The receiving a data transmission request sent by an application in user mode includes: Receive data transfer requests sent by user-mode applications through the virtual file system interface.
3. According to the data migration method of claim 1, It is characterized in that Before using multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-state application and the kernel-state cache, the method further includes: A data migration thread pool is created; wherein the data migration thread pool includes a plurality of the data migration threads.
4. According to the data migration method of claim 1, It is characterized in that Dividing the read and write data corresponding to the data transmission request into a plurality of data sub-segments, including: The read / write data corresponding to the data transmission request is divided into a plurality of data sub-segments in sequence based on a preset length.
5. According to the data migration method of claim 1, It is characterized in that The method of using multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-state application and the kernel-state cache includes: Creating a corresponding plurality of data migration tasks based on address information of the plurality of data sub-segments; A plurality of data migration tasks are executed in parallel by using a plurality of data migration threads, so as to realize data migration of a plurality of data sub-segments between the application program in the user state and the cache in the kernel state.
6. According to the data migration method of claim 5, It is characterized in that The address information of the data sub-segment includes a memory management unit corresponding to the application, a length of the data sub-segment, a source address, and a destination address.
7. The data migration method according to claim 6, It is characterized in that The method of using multiple data migration threads to execute multiple data migration tasks in parallel to achieve data migration of multiple data sub-segments between the user-state application and the kernel-state cache includes: Switching multiple data migration threads to the address space of the user state based on the memory management unit corresponding to the application; A plurality of data migration threads are used to migrate the plurality of data sub-segments between the user-state application and the kernel-state cache based on the corresponding source addresses and destination addresses of the plurality of data sub-segments.
8. According to the data migration method of claim 6, It is characterized in that Before creating a plurality of corresponding data migration tasks based on the address information of the plurality of data sub-segments, the method further includes: The cache of the application is divided into a plurality of first segments based on a preset length, and the cache of the application is divided into a plurality of first segments based on a plurality of The starting address of the first segment determines the source addresses of the corresponding plurality of data sub-segments; The kernel-mode cache is divided into a plurality of second segments based on the preset length, and the destination addresses of the corresponding plurality of data sub-segments are determined based on the start addresses of the plurality of second segments.
9. The data migration method according to claim 8, It is characterized in that The method of using multiple data migration threads to execute multiple data migration tasks in parallel to achieve data migration of multiple data sub-segments between the user-state application and the kernel-state cache includes: A plurality of data migration tasks are executed in parallel using a plurality of data migration threads to migrate a plurality of data sub-segments from the user-state application to the kernel-state cache.
10. The data migration method according to claim 6, It is characterized in that Before creating a plurality of corresponding data migration tasks based on the address information of the plurality of data sub-segments, the method further includes: Dividing the kernel-mode cache into a plurality of second segments based on a preset length, and determining corresponding source addresses of a plurality of the data sub-segments based on start addresses of the plurality of the second segments; The cache of the application is divided into a plurality of first segments based on the preset length, and the destination addresses of the corresponding plurality of data sub-segments are determined based on the start addresses of the plurality of first segments.
11. The data migration method according to claim 10, It is characterized in that The method of using multiple data migration threads to execute multiple data migration tasks in parallel to achieve data migration of multiple data sub-segments between the user-state application and the kernel-state cache includes: A plurality of data migration tasks are executed in parallel using a plurality of data migration threads to migrate a plurality of data sub-segments from the kernel-state cache to the user-state application.
12. The data migration method according to claim 1, It is characterized in that After the plurality of data sub-segments are migrated in parallel between the user-state application and the kernel-state cache using the plurality of data migration threads, the method further includes: Divide the migrated data into multiple data stripes; A plurality of erasure redundancy calculation threads are used to perform erasure redundancy calculation on the plurality of data stripes in parallel; wherein the erasure redundancy calculation threads correspond to the data stripes one by one.
13. The data migration method according to claim 12, It is characterized in that Before performing erasure redundancy calculation on the plurality of data stripes in parallel using the plurality of erasure redundancy calculation threads, the method further includes: An erasure redundancy calculation thread pool is created; wherein the erasure redundancy calculation thread pool includes a plurality of the erasure redundancy calculation threads.
14. The data migration method according to claim 12, It is characterized in that The step of dividing the migrated data into a plurality of data stripes includes: The migrated data is divided into multiple data stripes in sequence based on a preset length.
15. The data migration method according to claim 12, It is characterized in that The using multiple erasure redundancy calculation threads to perform erasure redundancy calculation on multiple data stripes in parallel includes: Creating corresponding multiple erasure redundancy calculation tasks based on the input cache addresses and output cache addresses of the multiple data stripes; A plurality of erasure redundancy calculation threads are used to perform erasure redundancy calculation on the plurality of data stripes in parallel.
16. The data migration method according to claim 12, It is characterized in that Before dividing the migrated data into a plurality of data stripes, the method further includes: Determining whether all the data migration threads have been completely executed; If all the data migration threads are executed completely, the step of dividing the migrated data into a plurality of data stripes is performed.
17. The data migration method according to claim 12, It is characterized in that After performing erasure redundancy calculation on the plurality of data stripes in parallel using the plurality of erasure redundancy calculation threads, the method further includes: Determine whether all the erasure redundancy calculation threads have been completely executed; If all the erasure redundancy calculation threads are executed completely, the data after the erasure redundancy calculation is sent to the storage system.
18. A data migration device, It is characterized in that include: A receiving module, configured to receive a data transmission request sent by an application in a user mode; A first division module is configured to divide the read / write data corresponding to the data transmission request into a plurality of data sub-segments; The migration module is configured to utilize multiple data migration threads to perform data migration on multiple data sub-segments in parallel between the user-mode application and the kernel-mode cache; wherein the data migration threads correspond one-to-one to the data sub-segments.
19. An electronic device, It is characterized in that include: a memory configured to store a computer program; A processor, configured to implement the steps of the data migration method according to any one of claims 1 to 17 when executing the computer program.
20. A non-volatile computer readable storage medium, It is characterized in that The computer non-volatile readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data migration method according to any one of claims 1 to 17 are implemented.
Citation Information
Patent Citations
User state RPC protocol multi-thread optimization method and system
CN106850698A
A redundant data processing method and device for an agricultural internet of things
CN109408466A
Data transmission method and device
CN109857545A
File transmission method, device and system
CN112637343A
Data communication method and device, electronic equipment and readable storage medium
CN113849238A
Cited By
Instruction bypass method and device and storage medium
CN120508453A
Fault detection method and device based on kernel mode and user mode, medium and product
CN120768748A
Kernel and user state-based fault detection method, device, medium and product
CN120768748B
Data transmission method and device, electronic equipment, storage medium and program product
CN121209961A
