Data synchronization method and device, readable storage medium and program product

By using an asynchronous architecture that separates primary and secondary metadata in the processor core, hot storage blocks are identified and data is synchronized precisely, which solves the problems of low resource utilization and lock contention latency, and improves data synchronization efficiency and resource utilization.

CN120909534AActive Publication Date: 2025-11-07LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511454346.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2025-11-07
Estimated Expiration
2045-10-13

AI Technical Summary

Technical Problem

Existing technologies suffer from low resource utilization and resource waste caused by multiple processor cores competing for bitmap locks, which is particularly evident in high-concurrency scenarios.

Method used

It adopts an asynchronous architecture that separates the primary and secondary metadata of the processor core. It records the write operations of storage blocks through a private bitmap and write counter array, divides the storage blocks into hot and cold storage blocks, and uses a log pointer array to record the changed data of hot storage blocks. It asynchronously aggregates to generate a global dirty bitmap and log association information table for accurate data synchronization.

Benefits of technology

It eliminates metadata lock contention latency and performance jitter in multi-core high-concurrency environments, improves resource utilization and data synchronization efficiency, and reduces network bandwidth and backend storage I/O load.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909534A_ABST
    Figure CN120909534A_ABST
Patent Text Reader

Abstract

The invention discloses a data synchronization method and device, a readable storage medium and a program product, and relates to the technical field of storage, and the method comprises the following steps: removing lock operation most sensitive to performance through a primary and secondary metadata separation asynchronous architecture of a processor core; metadata lock contention delay and performance jitter caused by the contention delay in a multi-core high-concurrency environment are fundamentally eliminated. According to the method, the hot storage blocks which cause relatively large pressure to network and back-end storage can be accurately identified, the log pointer array is set to carry out change data recording on the hot storage blocks, and the synchronization mode of the hot storage blocks is degraded from transmission of the whole storage blocks to transmission of only accurate change, so that the problems of low resource utilization rate and high data transmission efficiency are solved. The technical problem that resource waste is caused by the fact that multiple cores fight for bitmap locks is solved, and the technical effects that metadata lock contention delay in the multi-core high-concurrency environment and performance jitter caused by the metadata lock contention delay are eliminated, the resource utilization rate is increased, and the data synchronization efficiency is improved are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of storage, in particular to a data synchronization method, device, readable storage medium and program product. BACKGROUND

[0002] The current volume layer replication method mainly divides the entire source storage volume into a series of fixed-size storage blocks in logic by the system. The system maintains a bitmap in the memory, and each bit in the bitmap corresponds to a storage block on the volume. When a write Input / Output (I / O) request arrives, the bitmap lock is acquired to access the bitmap, and the storage blocks covered by the write request are marked as dirty in the bitmap. Then the data in the storage blocks marked as dirty is synchronized to the remote, and the lock is released.

[0003] It is easy to cause write amplification problem and low resource utilization. In a high concurrency scenario, a large number of I / O requests will compete for the same bitmap lock, causing the processor core that fails to successfully acquire the lock to waste resources. SUMMARY

[0004] The present application provides a data synchronization method, device, readable storage medium and program product to at least solve the problem of low resource utilization and resource waste caused by multiple cores competing for bitmap locks in related technologies.

[0005] The present application provides a data synchronization method, comprising: Respectively record the write operation of each storage block in each preset time window by using the private bitmap in the main metadata structure corresponding to each processor core; Record the number of write operations of each storage block in each preset time window by using the write counter array in each main metadata structure; Divide each dirty storage block with write operation into cold storage block and hot storage block according to the number of write operations recorded in the write counter array, and record the change data of the hot storage block by using the log pointer array corresponding to each processor core; wherein the log pointer array includes the log address of the memory corresponding to the storage of the change data of the hot storage block; Aggregate each private bitmap according to a preset aggregation period to obtain a global dirty bitmap; wherein the preset aggregation period is greater than or equal to the preset time window; Generate a global log association information table according to each log pointer array; Synchronize data according to the global dirty bitmap and the global log association information table.

[0006] The present application also provides an electronic device, comprising: a memory for storing a computer program; a processor for executing the computer program to implement the steps of any of the above data synchronization methods.

[0007] The application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program.

[0008] The application further provides a computer program product, which comprises a computer program.

[0009] According to the application, the master and auxiliary metadata separation asynchronous architecture of the processor core is used to remove the lock operation most sensitive to performance, and fundamentally eliminate the metadata lock contention delay in the multi-core high concurrency environment and the performance jitter caused thereby. The hot storage block causing great pressure on the network and the backend storage can be accurately identified, the log pointer array is used to record the changed data of the hot storage block, and the synchronization mode of the hot storage block is degraded from transmitting the whole storage block to transmitting only the accurate change, so that the network bandwidth and the backend storage I / O load required for data synchronization are greatly reduced, the resource utilization is improved, and the data synchronization efficiency is improved. Therefore, the technical problems of low resource utilization and resource waste caused by the contention for the bitmap lock among multiple cores can be solved, and the technical effects of eliminating the metadata lock contention delay in the multi-core high concurrency environment and the performance jitter caused thereby, improving the resource utilization, and improving the data synchronization efficiency are achieved. BRIEF DESCRIPTION OF DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0011] Figure 1 A schematic diagram of a data synchronization system according to an embodiment of the application is shown in FIG. 1. Figure 2 An implementation flowchart of a data synchronization method according to an embodiment of the application is shown in FIG. 2. Figure 3 An implementation flowchart of another data synchronization method according to an embodiment of the application is shown in FIG. 3. Figure 4 A structural block diagram of a data synchronization device according to an embodiment of the application is shown in FIG. 4. DETAILED DESCRIPTION

[0012] With reference to the drawings, the technical solutions in the embodiments of the present application will be clearly and completely described in order to make the technical solutions in the embodiments of the present application apparent to those skilled in the art. Obviously, the described embodiments are only a part rather than all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the protection scope of the present application.

[0013] It should be noted that, in the description of the present application, the terms "comprising", "containing" or any other variants thereof are intended to cover non-exclusive containing, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device. The terms "first", "second" and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.

[0014] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.

[0015] In combination with the specific application environment architecture or specific hardware architecture on which the execution of the data synchronization method depends, the specific application environment architecture or specific hardware architecture is described here.

[0016] Referring to Figure 1 , Figure 1 An architecture diagram of a data synchronization system provided by an embodiment of the present application. The system architecture is mainly composed of three modules: a lock-free tracking module, an adaptive block management module and a synchronization aggregation module.

[0017] Lock-free tracking module: located at the front end, directly facing and processing the I / O requests of the application program. Through the innovative design of main and secondary metadata separation, an exclusive main metadata structure is created for each processor core, so as to realize lock-free operation of change records.

[0018] Storage block management module: on the basis of the performance provided by the lock-free architecture, a strategy is realized which can dynamically adjust the tracking granularity according to real-time work load. It dynamically switches from the default coarse-grained bitmap tracking mode to the fine-grained log address tracking mode for hot storage blocks with high-frequency writing by real-time analysis of the writing mode of the storage block.

[0019] Synchronization aggregation module: as the back end of the system, a separate low-priority thread is responsible for it. It periodically and asynchronously safely aggregates all processor core private change information into the global secondary bitmap, and finally the data synchronization process executes efficient differential intelligent synchronization according to the aggregated metadata.

[0020] Embodiments of the present application provide a data synchronization method, which is described in detail in combination with an execution flow of the data synchronization method.

[0021] Referring to Figure 2 , Figure 2 An implementation flowchart of a data synchronization method provided by the embodiments of the present application is shown in FIG. 2. The method can include the following steps.

[0022] S201: In each preset time window, record the write operation of each storage block by using the private bitmap in the master metadata structure corresponding to each processor core.

[0023] The time window of data synchronization is set in advance, and the corresponding master metadata structure is constructed in advance for each processor core. The private bitmap is included in each master metadata structure, thereby obtaining the private bitmap corresponding to each processor core. In each preset time window, the write operation of each storage block is recorded by using the private bitmap in the master metadata structure corresponding to each processor core.

[0024] It should be noted that the preset time window can be set and adjusted according to actual conditions, and the present application does not limit the comparison, for example, it can be set to 10 ms.

[0025] S202: Record the write times of each storage block in each preset time window by using the write counter array in each master metadata structure.

[0026] Each master metadata structure further includes a write counter array. Each element in the write counter array corresponds to a storage block, and is used to count the number of times that each storage block is written by the processor core in the preset time window. The write times of each storage block in each preset time window are recorded by using the write counter array in each master metadata structure. By recording the write times of each storage block in each preset time window, the write frequency of each storage block by each processor core can be obtained.

[0027] S203: According to the write times recorded in the write counter array, divide each dirty storage block with write operation into a cold storage block and a hot storage block, and use the log pointer array corresponding to each processor core to record the changed data of the hot storage block.

[0028] The log pointer array includes the log address of the memory corresponding to the changed data of the hot storage block.

[0029] The log pointer array including the log address corresponding to the memory storing the changed data of the hot storage block is set for each processor core in advance. Within a preset time window, the storage block with data written is a dirty storage block. After recording the number of writes of each storage block within each preset time window by using the write counter array in each primary metadata structure, each dirty storage block with a write operation is divided into a cold storage block and a hot storage block according to the number of writes recorded in the write counter array, and the hot storage block is recorded with changed data by using the log pointer array corresponding to each processor core. By dividing the cold and hot storage blocks according to the number of writes and recording the changed data of the hot storage block, only the changed data is synchronized when the hot storage block is synchronized subsequently, and the data of the entire storage block does not need to be synchronized, which greatly reduces the amount of data to be synchronized and improves the data synchronization efficiency.

[0030] S204: aggregating each private bitmap according to a preset aggregation period to obtain a global dirty bitmap.

[0031] The preset aggregation period is greater than or equal to the preset time window.

[0032] The preset aggregation period is set in advance, and the preset aggregation period is greater than or equal to the preset time window. After recording the write operation of each storage block by using the private bitmap in the primary metadata structure corresponding to each processor core, each private bitmap is aggregated according to the preset aggregation period to obtain a global dirty bitmap. Thus, the storage blocks with a write operation within the preset time window are summarized.

[0033] The preset aggregation period can be set as an integer multiple of the preset time window, for example, when the preset time window is set as 10 ms, the preset aggregation period can be set as 1 s. By setting the preset aggregation period as an integer multiple of the preset time window, the integrity of the data aggregated is ensured.

[0034] S205: generating a global log association information table according to each log pointer array.

[0035] After recording the number of writes of each storage block within each preset time window by using the write counter array in each primary metadata structure, a global log association information table is generated according to each log pointer array. By merging the changed data recorded in the log pointer array, the global log association information table is obtained, and thus the data change of the hot storage block within the entire preset time window is summarized.

[0036] S206: performing data synchronization according to the global dirty bitmap and the global log association information table.

[0037] After aggregating each private bitmap at the end of each preset time window respectively to obtain a global dirty bitmap, and generating a global log association information table according to each log pointer array, data synchronization is performed according to the global dirty bitmap and the global log association information table. The data in the cold storage block in which there is no changed data record in the global log association information table can be synchronized in whole in combination with the global dirty bitmap and the global log association information table, and only the changed data is synchronized for the hot storage block in which there is a changed data record in the global log association information table, so that the differentiated synchronization of the cold storage block and the hot storage block is realized, the data synchronization amount is greatly reduced, and the data synchronization efficiency is improved.

[0038] According to the application, the lock operation most sensitive to performance is removed through the primary and secondary metadata separation asynchronous architecture of the processor core, so that the metadata lock contention delay in the multi-core high concurrency environment and the performance jitter caused thereby are fundamentally eliminated. The hot storage block that causes great pressure on the network and the backend storage can be accurately identified, the log pointer array is set to record the changed data of the hot storage block, and the synchronization mode of the hot storage block is downgraded from transmitting the entire storage block to transmitting only the accurate change, so that the network bandwidth and the backend storage I / O load required for data synchronization are greatly reduced, the resource utilization is improved, and the data synchronization efficiency is improved. Therefore, the technical problems of low resource utilization and resource waste caused by contention for the bitmap lock by multiple cores can be solved, and the technical effects of eliminating the metadata lock contention delay in the multi-core high concurrency environment and the performance jitter caused thereby, improving the resource utilization, and improving the data synchronization efficiency are achieved.

[0039] Referring to Figure 3 , Figure 3 An implementation flowchart of another data synchronization method provided by the embodiment of the application can include the following steps.

[0040] S301: In each preset time window, the private bitmap in the primary metadata structure corresponding to each processor core is used to record the write operation of each storage block.

[0041] S302: Obtain a preset write frequency threshold.

[0042] The write frequency threshold in a preset time window is set in advance, and the preset write frequency threshold is obtained.

[0043] It should be noted that the preset write frequency threshold can be set and adjusted according to actual conditions, and the embodiment of the application does not limit this, for example, it can be set to 3 times.

[0044] In one specific embodiment of the application, step S302 can include the following steps: Step one: Obtain the memory usage rate corresponding to the starting point of each preset time window; Step two: determine the preset write number threshold corresponding to each preset time window according to the memory usage.

[0045] For the convenience of description, the above two steps can be combined for description.

[0046] The write number threshold can be dynamically and adaptively set according to the memory usage. The memory usage corresponding to the starting point of each preset time window is obtained, and the preset write number threshold corresponding to each preset time window is determined according to the memory usage. For example, when the system memory resource is tight, the preset write number threshold can be automatically increased, so that the condition for strategy upgrade is more stringent, thereby reducing the allocation of log addresses and protecting the system memory. Through the dynamic and adaptive setting of the write number threshold according to the memory usage, the system memory is reasonably utilized.

[0047] S303: divide each dirty storage block into a cold storage block and a hot storage block according to the preset write number threshold and the write number recorded in the write counter array, and determine whether there is a log address corresponding to the hot storage block in the log pointer array; if not, execute step S304; if yes, execute step S305.

[0048] After obtaining the preset write number threshold, each dirty storage block is divided into a cold storage block and a hot storage block according to the preset write number threshold and the write number recorded in the write counter array, that is, the preset write number threshold can be used as the division limit of cold and hot storage blocks, the storage block corresponding to the write number greater than or equal to the preset write number threshold is determined as a hot storage block, and the storage block corresponding to the write number less than the preset write number threshold is determined as a cold storage block. After the hot storage block is determined, it is determined whether there is a log address corresponding to the hot storage block in the log pointer array; if not, it means that the hot storage block is determined as a hot storage block for the first time in the preset time window, and step S304 is executed; if yes, it means that the hot storage block is determined as a hot storage block for the first time in the preset time window, and step S305 is executed.

[0049] In one specific embodiment of the present application, dividing each dirty storage block into a cold storage block and a hot storage block according to the preset write number threshold and the write number recorded in the write counter array can include the following steps: Step one: compare the write number corresponding to each dirty storage block recorded in the write counter array with the preset write number threshold; Step two: determine the dirty storage block corresponding to the write number greater than or equal to the preset write number threshold as a hot storage block; Step three: determine the dirty storage block corresponding to the write number less than the preset write number threshold as a cold storage block.

[0050] For the convenience of description, the above three steps can be combined for description.

[0051] After obtaining the preset write number threshold, the write number corresponding to each dirty storage block recorded in the write counter array is compared with the preset write number threshold, the dirty storage block corresponding to the write number greater than or equal to the preset write number threshold is determined as a hot storage block, and the dirty storage block corresponding to the write number less than the preset write number threshold is determined as a cold storage block. By setting the preset write number threshold as the division limit of the cold and hot storage blocks, the quick and accurate division of the cold and hot storage blocks is realized.

[0052] In one specific embodiment of the present application, the division of each dirty storage block into a cold storage block and a hot storage block according to the preset write number threshold and the write number recorded in the write counter array can include the following steps: The division of each dirty storage block into a cold storage block and a hot storage block according to the preset write number threshold and the write number recorded in the write counter array is realized through a hysteresis control mechanism.

[0053] After obtaining the preset write number threshold, the division of each dirty storage block into a cold storage block and a hot storage block according to the preset write number threshold and the write number recorded in the write counter array is realized through a hysteresis control mechanism. For example, if the time window is set to 10 ms and the write number threshold is 3, when a storage block is first determined to be a hot storage block, the system will only determine it to be a hot storage block and allocate a log address for it when the write frequency of the storage block exceeds a higher hot threshold (Threshold_Hot) in the time window, such as 5 times of writing in 10 ms. A storage block that has been marked as a hot storage block will only be recycled in the subsequent background cleaning and downgraded to a cold storage block when its write frequency continuously falls below a lower cold threshold (Threshold_Cold) in a longer time window, such as less than 1 time of writing in 1 second. A stable buffer interval is formed between Threshold_Hot and Threshold_Cold, avoiding the frequent switching of storage blocks with critical write behavior (i.e. the storage blocks with write frequency fluctuating around the preset write number threshold) between cold and hot storage blocks, and thus avoiding the repeated allocation and release of log addresses, greatly enhancing the stability of the switching of cold and hot storage blocks.

[0054] S304: determining that the hot storage block is the first hot storage block determined in a preset time window, allocating a log address for the hot storage block, and storing the allocated log address in a log pointer array, and using the memory corresponding to the log address to record changed data.

[0055] If the log address corresponding to the hot storage block does not exist in the log pointer array, it is determined that the hot storage block is the first time to be determined as a hot storage block within a preset time window, and the log address corresponding to the hot storage block does not exist in the log pointer array corresponding to the processor core within the preset time window. The log address is allocated to the hot storage block, and the allocated log address is stored in the log pointer array, and the memory corresponding to the log address is changed. By allocating the log address to the storage block determined to be the first time to be determined as a hot storage block, the accurate record of the change data of the hot storage block is ensured.

[0056] S305: Determine that the hot storage block is not the first time to be determined as a hot storage block within a preset time window, find the log address corresponding to the hot storage block from the log pointer array, obtain the offset of the memory corresponding to the log address, and add the change data to the memory corresponding to the log address according to the offset.

[0057] The log pointer array includes the log address corresponding to the memory storing the change data of the hot storage block.

[0058] If the log address corresponding to the hot storage block exists in the log pointer array, it is determined that the hot storage block is not the first time to be determined as a hot storage block within a preset time window, the log address corresponding to the hot storage block is found from the log pointer array, the offset of the memory corresponding to the log address is obtained, and the change data is added to the memory corresponding to the log address according to the offset. By adding the change data corresponding to the hot storage block with the log address in the log pointer array to the memory corresponding to the log address, the multiple random write operations on the same hot storage block are converted into an efficient sequential write operation in the memory, and the accurate and ordered record of the change data of the hot storage block is realized. It provides convenience for subsequent data synchronization, and further improves the data synchronization efficiency. And avoid repeated allocation of memory, realize the fast record of change data.

[0059] S306: Acquire the lock of the global vice bit map according to the preset aggregation period, aggregate each private bit map by traversing the main metadata structure corresponding to each processor core, and obtain the global dirty bit map.

[0060] After the change data of the hot storage block is recorded, the lock of the global vice bit map is acquired according to the preset aggregation period, each private bit map is aggregated by traversing the main metadata structure corresponding to each processor core, and the global dirty bit map is obtained.

[0061] S307: Release the lock of the global vice bit map.

[0062] After the global dirty bitmap is aggregated, the lock of the global secondary bitmap is released. The lock of the global secondary bitmap is obtained when the private bitmaps at the end of each preset time window are aggregated, so that the global secondary bitmap is locked, interference of the write operation of each storage block in the next aggregation period is avoided, and accurate recording of the write operation of each storage block in each preset time window is ensured. The granularity of the lock is changed from one write request once in the traditional method to one aggregation period once in the embodiment of the application, frequent use of the lock is avoided, the system can still provide low-delay and high-throughput data synchronization capability under high load, and the data synchronization efficiency is improved.

[0063] S308: generating a global log association information table according to the log pointer arrays.

[0064] S309: generating a global secondary bitmap according to the global dirty bitmap and the global log association information table.

[0065] After the global dirty bitmap is aggregated and the global log association information table is generated according to the log pointer arrays, the global secondary bitmap is generated according to the global dirty bitmap and the global log association information table, so that the global secondary bitmap corresponding to the preset time window is obtained. The global secondary bitmap is used to realize comprehensive and accurate recording of the write operation of each storage block in the preset time window, and accurate reference data is provided for data synchronization.

[0066] S310: determining a dirty storage block with a write operation in each preset time window according to the global secondary bitmap, and obtaining a block identification number of the dirty storage block.

[0067] After the global secondary bitmap is generated according to the global dirty bitmap and the global log association information table, the global secondary bitmap records the storage number of each storage block and the write state of each storage block. The dirty storage block with a write operation in each preset time window is determined according to the global secondary bitmap, and the block identification number of the dirty storage block is obtained.

[0068] S311: performing log address lookup on the global log association information table according to the block identification number.

[0069] For the dirty storage block with a log address, the corresponding relationship between the block identification number and the log address of the dirty storage block is stored in the global log association information table in advance. After the block identification number of the dirty storage block is obtained, log address lookup is performed on the global log association information table according to the block identification number.

[0070] S312: performing data synchronization on the data in the dirty storage block with the log address according to the changed data recorded in the memory corresponding to the log address.

[0071] The global log association information table is looked up according to the block identification number, if the log address is found in the global log association information table, it is indicated that the dirty storage block is a hot storage block, data in the dirty storage block where the log address is found is synchronized according to the changed data recorded in the memory corresponding to the log address.

[0072] S313: The data in the dirty storage block where the log address is not found is synchronized, and all data in the dirty storage block is synchronized.

[0073] The global log association information table is looked up according to the block identification number, if the log address is not found in the global log association information table, it is indicated that the dirty storage block is a cold storage block, the data in the dirty storage block where the log address is not found is synchronized, and all data in the dirty storage block is synchronized.

[0074] The global log association information table is looked up, the dirty storage block is divided into hot and cold storage blocks according to the lookup result, the changed data of the hot storage block is quickly found, and then the hot storage block and the cold storage block are synchronized according to the respective data synchronization mode, only the changed data of the hot storage block is synchronized, and the data synchronization efficiency is improved.

[0075] The whole strategy switching process from the coarse-grained bitmap tracking to the fine-grained log address tracking is automatically triggered and managed by the system according to the real-time workload, without any manual intervention, parameter configuration or post-tuning, and the universality is greatly improved.

[0076] In a specific embodiment of the application, before recording the write operation of each storage block by using the private bitmap in the main metadata structure corresponding to each processor core, the method can further include the following steps: Step one: obtaining the non-uniform memory access nodes to which each processor core belongs respectively; Step two: allocating memory from the non-uniform memory access nodes to which each processor core belongs respectively, and constructing the main metadata structure corresponding to each processor core by using the allocated memory.

[0077] For convenience of description, the above two steps can be combined for description.

[0078] Obtain the non-uniform memory access (NUMA) nodes to which each processor core belongs respectively, allocate memory from the non-uniform memory access nodes to which each processor core belongs respectively, and construct the primary metadata structure corresponding to each processor core by using the allocated memory. By allocating memory from the non-uniform memory access nodes to which each processor core belongs to construct the primary metadata structure, the NUMA affinity of the constructed primary metadata structure is improved.

[0079] In one specific embodiment of the present application, recording the write operation of each storage block by using the private bitmap in the primary metadata structure corresponding to each processor core can include the following steps: Step one: determining the write logical address and data length corresponding to each write request received respectively; Step two: determining the storage block corresponding to each write request according to the write logical address and data length; Step three: determining the processor core corresponding to each write request, and setting the flag of the storage block in the private bitmap to the dirty state by using the processor core to obtain each dirty data block.

[0080] For convenience of description, the above three steps can be combined for description.

[0081] After receiving each write request, the write logical address and data length corresponding to each write request received respectively are determined, the storage block corresponding to each write request is determined according to the write logical address and data length, the processor core corresponding to each write request is determined, and the flag of the storage block in the private bitmap is set to the dirty state by using the processor core to obtain each dirty data block. By calculating the storage block covered by each write request according to the write logical address and data length, the dirty storage block is determined, and the fast and accurate determination of the dirty storage block is realized.

[0082] In one specific embodiment of the present application, the method can further include the following steps: After aggregating the private bitmap in each primary metadata structure to the global secondary bitmap, emptying each primary metadata structure.

[0083] After aggregating the private bitmap in each primary metadata structure to the global secondary bitmap, emptying each primary metadata structure. By emptying each primary metadata structure in time after aggregating the private bitmap in each primary metadata structure to the global secondary bitmap, each primary metadata structure is released in time, and interference with the write operation record of the storage block in the next aggregation period is avoided.

[0084] In one specific embodiment of the present application, generating the global log association information table according to the log pointer arrays can include the following steps: Step one: determining the storage blocks with log addresses according to the log pointer arrays; Step two: inserting the log addresses into the global log association information table, and marking the log addresses corresponding to the storage blocks with log addresses in the global vice bitmap as the state of existing log addresses; wherein the global vice bitmap is constructed from the global dirty bitmap and the global log association information table.

[0085] For convenience of description, the above two steps can be combined for description.

[0086] After obtaining the global dirty bitmap and the global log association information table, the storage blocks with log addresses are determined according to the log pointer arrays, the log addresses are inserted into the global log association information table, and the log addresses corresponding to the storage blocks with log addresses are marked in the global vice bitmap as the state of existing log addresses. By recording the log address states of the storage blocks in the global vice bitmap, accurate indication is provided for log address searching in subsequent data synchronization, and the data synchronization efficiency is further improved.

[0087] Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment.

[0088] The embodiments of the present application also provide a data synchronization device.

[0089] Referring to Figure 4 , Figure 4 The structure block diagram of a data synchronization device provided by the embodiments of the present application, the device can include: The write operation recording module 41 is configured to record the write operations of the storage blocks in each preset time window by using the private bitmap in the main metadata structure corresponding to each processor core, respectively; The write number recording module 42 is configured to record the write numbers of the storage blocks in each preset time window by using the write counter array in each main metadata structure; The changed data recording module 43 is configured to divide the dirty storage blocks with write operations into cold storage blocks and hot storage blocks according to the write numbers recorded in the write counter array, and record the changed data of the hot storage blocks by using the log pointer array corresponding to each processor core, respectively; wherein the log pointer array includes the log addresses corresponding to the memories storing the changed data of the hot storage blocks; The global dirty bitmap obtaining module 44 is configured to aggregate the private bitmaps respectively at the end of each preset time window to obtain a global dirty bitmap. The association information table generating module 45 is configured to generate a global log association information table according to the log pointer arrays. The data synchronization module 46 is configured to perform data synchronization according to the global dirty bitmap and the global log association information table.

[0090] According to the application, the performance-sensitive lock operation is removed by the primary and secondary metadata separation asynchronous architecture of the processor core, so that the metadata lock contention delay in the multi-core high-concurrency environment and the performance jitter caused thereby are fundamentally eliminated. The hot storage block that causes greater pressure on the network and the backend storage can be accurately identified, the log pointer array is used to record the changed data of the hot storage block, and the synchronization mode of the hot storage block is downgraded from transmitting the entire storage block to transmitting only the accurate changes, so that the network bandwidth and the backend storage I / O load required for data synchronization are greatly reduced, the resource utilization is improved, and the data synchronization efficiency is improved. Therefore, the technical problems of low resource utilization and resource waste caused by the contention for the bitmap lock among multiple cores can be solved, and the technical effects of eliminating the metadata lock contention delay in the multi-core high-concurrency environment and the performance jitter caused thereby, improving the resource utilization, and improving the data synchronization efficiency are achieved.

[0091] In one specific embodiment of the application, the data synchronization module 46 can include: The global secondary bitmap generating submodule is configured to generate a global secondary bitmap according to the global dirty bitmap and the global log association information table. The block identification number obtaining submodule is configured to determine the dirty storage blocks with write operations in each preset time window according to the global secondary bitmap, and obtain the block identification numbers of the dirty storage blocks. The log address searching submodule is configured to search the global log association information table according to the block identification numbers. The first data synchronization submodule is configured to synchronize the data in the dirty storage blocks with the searched log addresses according to the changed data recorded in the memory corresponding to the log addresses. The second data synchronization submodule is configured to synchronize the data in the dirty storage blocks without the searched log addresses, and synchronize all the data in the dirty storage blocks.

[0092] In one specific embodiment of the application, the device can further include: The node obtaining module is configured to obtain the non-uniform memory access nodes to which each processor core belongs respectively before each processor core records the write operations of each storage block by using the private bitmap in the primary metadata structure corresponding to the processor core respectively in each preset time window. ​The master metadata structure construction module is configured to allocate memory from the non-uniform memory access node to which the processor core belongs respectively, and construct the master metadata structure corresponding to each processor core respectively by using the allocated memory.

[0093] In one embodiment of the present application, the change data recording module 43 can include: The threshold obtaining submodule is configured to obtain a preset write frequency threshold. The cold and hot storage block division submodule is configured to divide each dirty storage block into a cold storage block and a hot storage block according to the preset write frequency threshold and the write frequency recorded in the write counter array.

[0094] In one embodiment of the present application, the cold and hot storage block division submodule can include: The comparison unit is configured to compare the write frequency corresponding to each dirty storage block recorded in the write counter array with the preset write frequency threshold. The hot storage block determination unit is configured to determine the dirty storage block corresponding to the write frequency greater than or equal to the preset write frequency threshold as a hot storage block. The cold storage block determination unit is configured to determine the dirty storage block corresponding to the write frequency less than the preset write frequency threshold as a cold storage block.

[0095] In one embodiment of the present application, the threshold obtaining submodule can include: The memory usage rate obtaining unit is configured to obtain the memory usage rate corresponding to the start point of each preset time window. The threshold determination unit is configured to determine the preset write frequency threshold corresponding to each preset time window according to the memory usage rate.

[0096] In one embodiment of the present application, the cold and hot storage block division submodule is specifically a module for dividing each dirty storage block into a cold storage block and a hot storage block according to the preset write frequency threshold and the write frequency recorded in the write counter array by using a hysteresis control mechanism.

[0097] In one embodiment of the present application, the write operation recording module 42 can include: The address and length determination submodule is configured to determine the write logical address and data length corresponding to each received write request respectively. The storage block determination submodule is configured to determine the storage block corresponding to each write request according to the write logical address and data length. The dirty data block obtaining submodule is configured to determine the processor core corresponding to each write request, and set the flag of the storage block in the private bitmap to the dirty state by using the processor core to obtain each dirty data block.

[0098] In an embodiment of the present application, the global dirty bitmap obtaining module 44 can comprise: a global dirty bitmap obtaining submodule, configured to acquire a lock of the global dirty bitmap according to a preset aggregation period, aggregate the private bitmaps respectively corresponding to the processor cores by traversing the primary metadata structures of the processor cores, and obtain the global dirty bitmap; a lock releasing submodule, configured to release the lock of the global dirty bitmap.

[0099] In an embodiment of the present application, the device can further comprise: a primary metadata structure emptying module, configured to empty the primary metadata structures after the private bitmaps in the primary metadata structures are aggregated into the global dirty bitmap.

[0100] In an embodiment of the present application, the change data recording module 43 can comprise: a judging submodule, configured to judge whether the log address corresponding to the hot storage block exists in the log pointer array; a change data recording submodule, configured to, when it is determined that the log address corresponding to the hot storage block does not exist in the log pointer array, determine that the hot storage block is the first time to be determined as the hot storage block within the preset time window, allocate a log address to the hot storage block, store the allocated log address in the log pointer array, and record the change data in the memory corresponding to the log address; a change data adding submodule, configured to, when it is determined that the log address corresponding to the hot storage block exists in the log pointer array, determine that the hot storage block is not the first time to be determined as the hot storage block within the preset time window, find the log address corresponding to the hot storage block from the log pointer array, acquire the offset of the memory corresponding to the log address, and add the change data to the memory corresponding to the log address according to the offset.

[0101] In an embodiment of the present application, the associated information table generating module 45 can comprise: a storage block determining submodule, configured to determine the storage block with the log address according to the log pointer arrays; a flag setting submodule, configured to insert the log address into the global log associated information table, and set the log address corresponding to the storage block with the log address in the global dirty bitmap to the state of existing log address; wherein, the global dirty bitmap is constructed from the global dirty bitmap and the global log associated information table.

[0102] The features of the embodiments of the data synchronization device can be referred to the related descriptions of the embodiments of the data synchronization method, which will not be repeated here.

[0103] The embodiment of the present application also provides an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor is arranged to run the computer program to execute the steps in any of the above data synchronization method embodiments.

[0104] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, wherein the computer program is arranged to execute the steps in any of the above data synchronization method embodiments when running.

[0105] In an example embodiment, the above computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.

[0106] The embodiment of the present application also provides a computer program product, which comprises a computer program, and the computer program is arranged to execute the steps in any of the above data synchronization method embodiments when running by a processor.

[0107] The embodiment of the present application also provides another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is arranged to execute the steps in any of the above data synchronization method embodiments when running by a processor.

[0108] The skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general in the above description. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0109] The above provides a detailed description of the data synchronization method, device, readable storage medium and program product provided by the present application. The principle and implementation mode of the present application are described by applying specific examples in this paper. The above description of the examples is only applicable to help understand the method of the present application and its core idea. It should be noted that for ordinary skilled in the art, without departing from the principle of the present application, the present application can be improved and modified in several ways, and these improvements and modifications also fall within the protection scope of the present application.

Claims

1. A data synchronization method, characterized by, The method comprises the following steps: record the write operation of each storage block in each preset time window by using the private bitmap in the main metadata structure corresponding to each processor core respectively; record the write times of each storage block in each preset time window by using the write counter array in each main metadata structure; divide the dirty storage blocks with write operation into cold storage blocks and hot storage blocks according to the write times recorded in the write counter array, and record the change data of the hot storage blocks by using the log pointer array corresponding to each processor core respectively; wherein the log pointer array includes the log address of the memory corresponding to the storage of the change data of the hot storage blocks; aggregate each private bitmap according to a preset aggregation period to obtain a global dirty bitmap; wherein the preset aggregation period is greater than or equal to the preset time window; generate a global log association information table according to each log pointer array; synchronize data according to the global dirty bitmap and the global log association information table.

2. The data synchronization method of claim 1, wherein, The data synchronization according to the global dirty bitmap and the global log association information table comprises the following steps: generate a global secondary bitmap according to the global dirty bitmap and the global log association information table; determine the dirty storage blocks with write operation in each preset time window according to the global secondary bitmap, and obtain the block identification number of the dirty storage blocks; log address lookup of the global log association information table according to the block identification number; synchronize the data in the dirty storage blocks with the change data recorded in the memory corresponding to the log address; synchronize all the data in the dirty storage blocks without log address.

3. The data synchronization method of claim 1, wherein, Before recording the write operation of each storage block in each preset time window by using the private bitmap in the main metadata structure corresponding to each processor core respectively, the method further comprises the following steps: obtain the non-uniform memory access node to which each processor core belongs respectively; allocate memory from the non-uniform memory access node to which each processor core belongs respectively, and construct the main metadata structure corresponding to each processor core by using the allocated memory.

4. The data synchronization method of claim 1, wherein, The division of the dirty storage blocks with write operation into cold storage blocks and hot storage blocks according to the write times recorded in the write counter array comprises the following steps: obtain a preset write times threshold; divide the dirty storage blocks into cold storage blocks and hot storage blocks according to the preset write times threshold and the write times recorded in the write counter array.

5. The data synchronization method of claim 4, wherein, The division of the dirty storage blocks into cold storage blocks and hot storage blocks according to the preset write times threshold and the write times recorded in the write counter array comprises the following steps: compare the write times of each dirty storage block recorded in the write counter array with the preset write times threshold respectively; determine the dirty storage blocks with write times greater than or equal to the preset write times threshold as hot storage blocks; determine the dirty storage blocks with write times less than the preset write times threshold as cold storage blocks.

6. The data synchronization method of claim 4, wherein, The obtaining of the preset write times threshold comprises the following steps: obtain the memory usage rate corresponding to the starting point of each preset time window respectively; determine the preset write times threshold corresponding to each preset time window according to the memory usage rate.

7. The data synchronization method of claim 4, wherein, According to the preset write number threshold and the write number recorded in the write counter array, each dirty storage block is divided into a cold storage block and a hot storage block, including: According to the preset write number threshold and the write number recorded in the write counter array, each dirty storage block is divided into a cold storage block and a hot storage block through a hysteresis control mechanism.

8. The data synchronization method of claim 1, wherein, The write operation of each storage block is recorded by using the private bitmap in the main metadata structure corresponding to each processor core, including: Determine the write logical address and data length corresponding to each write request received respectively; According to the write logical address and the data length, determine the storage block corresponding to each write request respectively; Determine the processor core corresponding to each write request respectively, and set the flag of the storage block in the private bitmap to a dirty state by using the processor core, to obtain each dirty data block.

9. The data synchronization method of claim 1, wherein, According to a preset aggregation period, aggregate each private bitmap to obtain a global dirty bitmap, including: According to a preset aggregation period, obtain a lock of a global secondary bitmap, aggregate each private bitmap by traversing the main metadata structure corresponding to each processor core, to obtain a global dirty bitmap; Release the lock of the global secondary bitmap.

10. The data synchronization method of claim 9, wherein, Further comprising: After aggregating the private bitmap in each main metadata structure to the global dirty bitmap, clear each main metadata structure.

11. The data synchronization method of any one of claims 1 to 10, wherein, Use the log pointer array corresponding to each processor core to record the changed data of the hot storage block, including: Determine whether there is a log address corresponding to the hot storage block in the log pointer array; If not, determine that the hot storage block is the first time to be determined as a hot storage block within the preset time window, allocate a log address to the hot storage block, and store the allocated log address in the log pointer array, and use the memory corresponding to the log address to record the changed data; If yes, determine that the hot storage block is not the first time to be determined as a hot storage block within the preset time window, find the log address corresponding to the hot storage block from the log pointer array, obtain the offset of the memory corresponding to the log address, and add the changed data to the memory corresponding to the log address according to the offset.

12. The data synchronization method of claim 1, wherein, Generate a global log association information table according to each log pointer array, including: Determine the storage block with a log address according to each log pointer array; Insert the log address into the global log association information table, and set the log address corresponding to the storage block with a log address in the global secondary bitmap to a log address existing state; wherein, the global secondary bitmap is constructed by the global dirty bitmap and the global log association information table.

13. An electronic device, comprising: Comprising: A memory for storing a computer program; A processor for executing the computer program to implement the steps of the data synchronization method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Inter-node bitmap information synchronization method, device and equipment and storage medium

    CN111399772A

  • Non-volatile memory caching method fusing data transmission and storage

    CN113312300A

  • Metadata and data organization architecture method in distributed persistent memory file system

    CN113704217A

  • Hotspot cache dynamic monitoring method and device, equipment and medium

    CN117215897A

  • Data hierarchical storage method and device based on access characterization, equipment and medium

    CN120743183A