A data compression method and related equipment

By mapping data pages to logical blocks and determining whether to compress them based on attribute information, the problem of resource waste in existing technologies is solved, achieving more efficient data compression and resource utilization.

CN119937904BActive Publication Date: 2026-01-30HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411751593.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-30
Publication Date
2026-01-30
Estimated Expiration
2044-11-30

AI Technical Summary

Technical Problem

Existing data compression methods still consume a lot of system resources in scenarios where there is only a small amount of cold data or no cold data in the data page, resulting in a waste of I/O resources.

Method used

By mapping multiple data pages to logical blocks, the system determines whether to compress data based on the attribute information of the logical blocks. Compression is only performed when the total size of cold data in a logical block is greater than or equal to a first threshold; otherwise, no compression is performed.

Benefits of technology

It reduces I/O overhead, saves system resources, and improves the efficiency of data compression and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119937904B_ABST
    Figure CN119937904B_ABST
Patent Text Reader

Abstract

This application provides a data compression method and related apparatus for reducing I / O overhead. The data compression method includes: acquiring attribute information of a logical block, the logical block comprising multiple data pages, the attribute information indicating the data size of the data included in the multiple data pages across multiple time periods. If the attribute information indicates that the total data size of the data included in the multiple data pages in a target time period is greater than or equal to a first threshold, then the data included in the logical block is compressed, and the compressed result is stored. The target time period includes at least one of the multiple time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold. If the first attribute information indicates that the total data size of the data included in the multiple data pages in the target time period is less than the first threshold, then it is determined that the data included in the logical block will not be compressed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more particularly to a data compression method and related equipment. Background Technology

[0002] With the continuous development of database technology, data compression has become a key means to improve storage efficiency, optimize performance, and reduce storage and operating costs. In practical applications, choosing the right compression method has become a pressing issue.

[0003] One data compression method employs row-level scanning granularity. The compression task traverses all data pages in the data table, scanning each row of data in each page sequentially. By recording the timestamp and compression status of each row, uncompressed cold data is identified from the data pages. If cold data offers a compression benefit, compression is performed on that data page, even if the cold data is only a portion of its content.

[0004] In this compression method, the compression task needs to traverse all data page by page and read the timestamp and compression status of each line to determine whether to perform compression. For scenarios where there is only a small amount of cold data or no cold data in the data page, this method still consumes system resources, resulting in a large waste of input / output (I / O) resources. Summary of the Invention

[0005] This application provides a data compression method and related equipment to reduce I / O overhead and save system resources.

[0006] Firstly, this application provides a data compression method, including:

[0007] Obtain the attribute information of a logical block, which comprises multiple data pages. The attribute information indicates the data size of the data pages across multiple time periods. If the attribute information indicates that the total data size of the data pages within a target time period is greater than or equal to a first threshold, compress the data within the logical block and store the compressed result. The target time period includes at least one of multiple time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold. If the attribute information indicates that the total data size of the data pages within a target time period is less than the first threshold, then it is determined that the data within the logical block will not be compressed. That is, no processing is performed on the data within the logical block.

[0008] In this application, multiple data pages are mapped to logical blocks, and the decision to compress the data contained within a logical block is determined based on the block's attribute information. Specifically, the attribute information indicates the data size of the multiple data pages within the logical block at different time periods. The data within the logical block is compressed only if the total data size of the cold data in these multiple data pages is greater than or equal to a first threshold. Otherwise, the data within the logical block is not compressed. The timestamps of the cold data are located within the target time period. In other words, for logical blocks where the total data size of the cold data is less than the first threshold, no compression operation is performed, reducing I / O overhead and saving system resources.

[0009] In some alternative implementations of the first aspect, the attribute information includes time period information and data size information corresponding to the time period information. The time period information indicates the time period in which the timestamp of the data is located. The data size information indicates the data volume, and the first threshold includes a data volume threshold. Alternatively, the data size information indicates the number of data rows, and the first threshold includes a data row count threshold.

[0010] In this application, the attribute information includes time period information and the corresponding data scale. Based on the attribute information, the relationship between the total data scale of the target time period and the first threshold can be determined, thereby determining whether the data of the corresponding logical block needs to be compressed. This provides technical support for the implementation of the technical solution of this application and improves the feasibility of the technical solution. In addition, the data scale includes the data volume or the number of data rows, which enriches the implementation methods and application scenarios of the technical solution of this application.

[0011] In some optional implementations of the first aspect, before obtaining the attribute information of the logic block, a first correspondence set is also obtained. This first correspondence set indicates a one-to-one correspondence between the identifiers and attribute information of multiple logic blocks. The identifier of the logic block is obtained, as it uniquely identifies the logic block. Then, obtaining the attribute information of the logic block specifically involves retrieving the attribute information corresponding to the logic block from the first correspondence set based on its identifier.

[0012] In this application, an attribute information is maintained for each logical block, and a one-to-one correspondence between the identifiers of multiple logical blocks and the attribute information is stored in a first correspondence set. Therefore, based on the identifier of the logical block, the attribute information can be determined from the first correspondence set. This provides technical support for the implementation of the technical solution of this application and improves its feasibility.

[0013] In several possible implementations of the first aspect, obtaining the identifier of the logical block can take several forms. Optionally, a second correspondence set is obtained, which includes the correspondence between logical block identifiers and data page numbers, where one logical block identifier corresponds to multiple data page numbers, and one data page number uniquely corresponds to one logical block identifier. The number of the currently read data page is then obtained. Based on the number of the currently read data page, the identifier of the logical block is determined from the second correspondence set.

[0014] In this application, the identifier of the logical block where the currently read data page is located is directly determined based on the second correspondence set, which is simple to operate and saves computing resources.

[0015] In some optional implementations of the first aspect, the identifier of the logical block can also be obtained based on the following methods: Obtain the number of the currently read data page, the data size of the data page, and the data size of the logical block. Based on the number of the currently read data page, the data size of the data page, and the data size of the logical block, determine the number of the target data page in the logical block; the target data page is either the starting data page or the ending data page of the logical block. Based on the number of the target data page and the target data size, determine the identifier of the logical block; the target data size is either the data size of the logical block or the data size of any data page within the logical block.

[0016] In this application, the target data page within the logical block containing the currently read data page is determined by its number. This target data volume is then combined with the target data volume to determine the identifier of the logical block. The target data page can be either the starting or ending data page of the logical block; the target data volume can be either the data volume of a data page or the data volume of a logical block. This provides multiple possibilities for the implementation of the technical solution in this application, enriching the application scenarios and implementation methods.

[0017] In some optional implementations of the first aspect, the identifier of the logical block can also be obtained based on the following method: Obtain the number of the currently read data page and the target data volume, where the target data volume is the data volume of the logical block, or the data volume of any one of multiple data pages. Determine the target identifier based on the number of the currently read data page and the target data volume. Determine the identifier of the logical block based on the identifier corresponding to the currently read logical page and the first correspondence set, where the target identifier is the same as the identifier of the logical block, or the target identifier is less than or greater than the identifier of the logical block, and the identifier of the logical block is closest to the target identifier in the correspondence set.

[0018] In this application, a target identifier is determined based on the number of the currently read data page and the target data volume. This target identifier is then compared with the identifiers of the logical blocks included in the first correspondence set to determine the identifier of the logical block containing the currently read data page. Since the relationship between the identifier of the logical block defined by the system configuration and the target data volume can be varied, and the server can determine the identifier of the logical block in multiple ways, this enriches the application scenarios of the technical solution in this application and improves its flexibility.

[0019] In some optional implementations of the first aspect, the data included in the compression logic block refers to the data page containing the cold data obtained from multiple data pages, where the timestamp of the cold data is located within the target time period. Compression is then performed on the data page containing the cold data. In other words, the data actually compressed is the cold data within the logic block that is located within the target time period.

[0020] In this application, the compressed data is cold data located in the target time period. Cold data has a low probability of being accessed again, and compressing it is in line with the data access pattern.

[0021] Secondly, this application provides a data compression apparatus, comprising:

[0022] An acquisition unit is used to acquire attribute information of a logical block, wherein the logical block includes multiple data pages, and the attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods;

[0023] A processing unit is configured to compress the data included in the logic block and store the compressed result if the attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is greater than or equal to a first threshold; wherein the target time period includes at least one of the plurality of time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold.

[0024] The processing unit is further configured to determine not to compress the data included in the logical block if the attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is less than the first threshold.

[0025] The data compression device is used to implement the method shown in the first aspect or any possible implementation of the first aspect, which will not be described in detail here.

[0026] Thirdly, this application provides a computing device including a processor and a memory. The processor of the computing device is used to execute instructions stored in the memory, causing the computing device to implement the method shown in the first aspect or any possible implementation of the first aspect.

[0027] Fourthly, this application provides a computing device cluster, including at least one computing device, each computing device including a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster implements the method disclosed in the first aspect or any possible implementation of the first aspect.

[0028] Fifthly, this application provides a computer program product containing instructions that, when executed on a processor, implement the method shown in the first aspect or any possible implementation of the first aspect; or, when the instructions are run by a cluster of computer devices, cause the cluster of computer devices to implement the method disclosed in the first aspect or any possible implementation of the first aspect.

[0029] Sixthly, this application provides a computer-readable storage medium storing computer program instructions that, when executed on a processor, implement the method described in the first aspect or any possible implementation of the first aspect; or, when executed by a cluster of computer devices, cause the cluster of computer devices to implement the method disclosed in the first aspect or any possible implementation of the first aspect.

[0030] The beneficial effects shown in any of the second to sixth aspects are similar to those of the first aspect or any possible implementation of the first aspect, and will not be repeated here. Attached Figure Description

[0031] Figure 1 A schematic diagram of a system architecture provided for an embodiment of this application;

[0032] Figure 2 Another system architecture diagram provided for an embodiment of this application;

[0033] Figure 3 A schematic flowchart of the data compression method provided in this application embodiment;

[0034] Figure 4 A schematic diagram of a logic block provided in an embodiment of this application;

[0035] Figure 5 A schematic diagram providing histograms for embodiments of this application;

[0036] Figure 6 Another schematic flowchart of the data compression method provided in the embodiments of this application;

[0037] Figure 7 A schematic diagram of the data compression apparatus provided in the embodiments of this application;

[0038] Figure 8 A schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0039] Figure 9 A schematic diagram of the structure of a computing device cluster provided in an embodiment of this application;

[0040] Figure 10 This is another schematic diagram of the computing device cluster provided in an embodiment of this application. Detailed Implementation

[0041] This application provides a data compression method and related equipment to reduce I / O overhead and save system resources.

[0042] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.

[0043] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to those processes, methods, products, or apparatuses. Additionally, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can be expressed as: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0044] First, please refer to Figure 1 and Figure 2 , Figure 1 and Figure 2 All of these are schematic diagrams of the system architecture provided in the embodiments of this application.

[0045] like Figure 1 As shown, a communication connection is established between the terminal device and the server. Based on this connection, the terminal device accesses data stored on the server or uses services provided by the server. In the data compression method provided in this embodiment, the user can trigger the server to perform a data compression operation through the terminal device. The server responds to the instruction from the terminal device and, based on the instruction, compresses the data stored on the server or the data managed by the server. The specific implementation process of data compression will be described in detail later and will not be elaborated here.

[0046] The technical solutions provided in this application can also be applied to cloud computing scenarios. For example... Figure 2 As shown, tenants log in to the cloud service platform via the internet using their registered account and password through a terminal device. The cloud service platform manages the infrastructure, which includes multiple data centers located in different regions, for example... Figure 2 Region 1, as shown, includes Cloud Data Center 1 and Cloud Data Center 2, while Region 2 includes Cloud Data Center 3 and Cloud Data Center 4. Each cloud data center has multiple servers, on which business instances (including at least one of virtual machines, containers, and dedicated hosts) are running.

[0047] In this embodiment, a data compression service is deployed in the business instance. The tenant purchases cloud services through a client on the cloud service platform and sends a request to the cloud service platform to request cloud services. The specific content of the cloud services includes providing the tenant with the data compression method described below.

[0048] In summary, the data compression method provided in this application can be applied to servers, virtual machines, cloud service platforms, etc. In the following description, a server is used as the execution subject. The implementation process for other types of execution subjects is similar.

[0049] It should be noted that the terminal device mentioned in the embodiments of this application can be a device with wireless transceiver function, specifically referring to user equipment (UE), access terminal, user unit (subscriber unit), user station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent, or user device. Terminal devices can also be satellite phones, cellular phones, smartphones, wireless data cards, wireless modems, machine-type communication devices, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, communication devices mounted on high-altitude aircraft, wearable devices, drones, robots, terminals in device-to-device (D2D) communication, terminals in vehicle-to-everything (V2X) communication, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, mixed reality (MR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical care, wireless terminals in smart grids, wireless terminals in transportation safety, and wireless terminals in smart cities. This application does not limit the scope of wireless terminals, such as those in a city, smart homes, or future communication networks.

[0050] In addition, in the embodiments of this application, there may be more or fewer terminal devices in this communication system. The number and type of terminal devices are determined according to actual needs, and are not limited here.

[0051] Please refer to the following. Figure 3 , Figure 3 A flowchart illustrating the data compression method provided in this application embodiment includes:

[0052] 301. Obtain the attribute information of the logical block. The logical block includes multiple data pages. The attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods.

[0053] A database runs on the server, or the server manages the database. Data in the database is stored in the form of data pages, with each data page containing the same amount of data. In this embodiment, multiple consecutive data pages are mapped to a logical block. This operation can also be understood as logically dividing the data into blocks, each logical block comprising multiple consecutive data pages. Furthermore, the amount of data in each logical block is the same; that is, each logical block includes the same number of data pages.

[0054] For example, please refer to Figure 4 , Figure 4 This is a schematic diagram of a logic block provided in an embodiment of this application. Figure 4 In the illustrated embodiment, N logic blocks are set, and each logic block includes n data pages. Logic block 1 includes data pages 0 to n-1, and logic block 2 includes data pages n to 2n-1.

[0055] In this embodiment, the granularity of the logic block is controllable; that is, the amount of data included in a logic block, or the number of logic blocks, can be set based on the needs of the actual application. Optionally, the amount of data included in a logic block, or the number of logic blocks, can be set by the user or defined by system parameters.

[0056] For example, assume that the data size of each data page in the database is fixed at 30MB. If the user-defined logical block size is 500MB, then each logical block includes 16 data pages. If the user-defined logical block size is 600MB, then each logical block includes 20 data pages.

[0057] For example, suppose the database has a storage capacity of 100GB, and each data page has a fixed size of 64MB. If the user sets the number of logical blocks to 200, then each logical block will have a size of 512MB, comprising 8 data pages. If the user sets the number of logical blocks to 100, then each logical block will have a size of 1024MB, comprising 16 data pages.

[0058] During database operation, the database responds to data read / write operations, and the data in the database is updated accordingly, including being read, written with new data, modified, and deleted. The server obtains the attribute information of logical blocks, which indicates the data scale of the logical block at different times. In other words, the attribute information reflects the distribution of data in the logical block.

[0059] Furthermore, the attribute information includes time period information and the corresponding data scale information. The time period information indicates the time period in which the data's timestamp falls. The data's timestamp represents the time when the data was most recently or last updated. The data scale information indicates the amount of data or the number of rows, reflecting the data scale for the corresponding time period.

[0060] In practical applications, attribute information can be represented in various ways, including histograms, tables, and key-value pairs. The following diagrams provide a more intuitive explanation of attribute information. Please refer to [link / reference]. Figure 5 , Figure 5 This is a schematic diagram of a histogram provided for an embodiment of this application.

[0061] like Figure 5 As shown, the histogram can visually display the amount of data in each time period, reflecting the data scale of the data included in the logic block in each time period. For example, the timestamps of data with a volume of m1 in the logic block are located in the time period from t0 to t1, the timestamps of data with a volume of m2 are located in the time period from t1 to t2, the timestamps of data with a volume of m3 are located in the time period from t2 to t3, and the timestamps of data with a volume of m4 are located in the time period from t3 to t4.

[0062] It should be noted that, Figure 5 The histogram shown is an example of a histogram with equal width, that is... Figure 5 The duration of each time period is the same. In practical applications, histograms can also take the form of equal-height histograms, compressed histograms, etc., but this is not a specific limitation here.

[0063] Optionally, attribute information can also be represented in tabular form. For example, Table 1 below shows an example of attribute information:

[0064] Table 1

[0065]

[0066] Table 1 shows the data size of each logical block in data table t at different time periods. As shown in Table 1, the data size of logical block chunk_0 is M1 in time period T1, M2 in time period T2, M3 in time period T3, and M4 in time period T4.

[0067] Similarly, the duration of each time period in Table 1 can be the same or different; no specific restrictions are imposed here. Additionally, time periods can also be represented by a start time and an end time, such as 00:00—12:00.

[0068] It should be noted that the aforementioned Figure 5Tables 1 and 2 use data volume as an example. In practical applications, the data size can also be the number of data rows; this is not limited here. Furthermore, the attribute information of logical blocks can be stored in system tables, fork files, or other devices accessible to the server; this is also not limited here.

[0069] In this embodiment of the application, the attribute information includes time period information and the data scale corresponding to the time period information. Based on the attribute information, the relationship between the total data scale of the target time period and the first threshold can be determined, thereby determining whether it is necessary to compress the data of the corresponding logical block. This provides technical support for the implementation of the technical solution of this application and improves the feasibility of the technical solution.

[0070] 302. The attribute information indicates whether the total data size of the data included in multiple data pages in the target time period is greater than or equal to the first threshold. If yes, proceed to step 303; otherwise, proceed to step 304.

[0071] The server obtains the attribute information of the logical block, analyzes the data scale of each time period indicated by the attribute information, and determines whether the total data scale of the cold data included in the logical block reaches a first threshold. If the total data scale of the cold data reaches the first threshold, that is, the total data scale of the cold data is greater than or equal to the first threshold, it indicates that the compression of the cold data is necessary. At this time, step 303 is executed, that is, the data included in the first logical block is compressed. Otherwise, step 304 is executed, that is, it is determined that the data included in the logical block will not be compressed.

[0072] Cold data refers to data whose timestamp falls within a target time period, where the time interval between the target time period and the current time is greater than or equal to a time threshold. The specific value of the time threshold is set based on the needs of the actual application and can be defined by the user or specified by system parameters; no specific limit is imposed here.

[0073] Furthermore, the target time period includes at least one of the multiple time periods indicated by the attribute information. If the target time period is one of multiple time periods, then the time interval between the target time period and the current time refers to the time interval between the end time of this time period and the current time. If the target time period includes multiple time periods, then the multiple time periods included in the target time period are consecutive. And the time interval between the target time period and the current time refers to the time interval between the end time of these multiple consecutive time periods and the current time.

[0074] For example, Figure 5 For example, assuming the current time is t4, each of the histogram's buckets represents a period of one day. Here, a histogram bucket refers to each bar in the graph; for instance, the bar representing the data volume m1 corresponding to t0 to t1 is a histogram bucket.

[0075] If the time threshold is 3 days, then the target period is the period from t0 to t1, and the total data size of the target period is m1.

[0076] If the time threshold is 1 day, then the target period is from t0 to t3, which includes the three periods of t0 to t1, t1 to t2, and t2 to t3. The total data size of the target period is m1 + m2 + m3.

[0077] In some optional implementations, if the time period indicated by the attribute information is an equal-length time period, the time threshold can be an integer multiple of the time period indicated by the time period information. For example, using... Figure 5 For example, assuming a time threshold of 4 days, the duration of each period in the graph can be 0.5 days, 1 day, 2 days, etc. Setting the time threshold to an integer multiple of the period information indicates allows direct determination of whether all data in each histogram is cold data or not, eliminating the need to further determine which data within each histogram is cold data and which is not. This simplifies the identification of cold data.

[0078] For example, suppose the time threshold is 2 days. Figure 5 If each bucket in the histogram has a duration of 1 day, the server can directly determine whether all the data in a bucket is cold data. If the time threshold is 3 days and each bucket has a duration of 2 days, if a bucket corresponds to a time period 2-4 days ago, the server needs to further analyze which data in the bucket has a timestamp that is greater than or equal to 2 days from the current time to determine which data is included in the bucket as cold data.

[0079] Furthermore, step 301 mentioned above introduced that the data scale includes the data volume or the number of data rows. Correspondingly, the first threshold includes the data volume threshold or the data row scale. The specific value of the first threshold is also set based on the needs of actual application, and can be defined by the user or specified by system parameters. No specific limitation is made here.

[0080] For example, suppose the compression scheduling policy is set to a timeframe of 2 days, meaning the time threshold is 2 days, and the duration of each time period defined by the attribute information is 1 day. Figure 5 For example, suppose Figure 5 The times t1 to t4 are November 9th 22:00, November 10th 22:00, November 11th 22:00, November 12th 22:00, and November 13th 22:00, respectively.

[0081] If the current time is t4, then the time periods corresponding to t0 to t1 and t1 to t2 are the target time periods, and the total amount of data corresponding to these two time periods is m1 + m2. The server compares the total amount of data m1 + m2 with the data volume threshold to determine whether the scale of cold data has reached the first threshold.

[0082] 303. Compress the data contained in the logic block and store the compressed result.

[0083] The server only compresses the data within a logical block if the total size of the cold data in that block is greater than or equal to a first threshold. In other words, in this embodiment, compression is not performed immediately upon the appearance of cold data; rather, the relationship between the total size of the cold data and the first threshold is considered. Therefore, by reasonably setting the value of the first threshold, not only can resource waste caused by frequent compression be avoided, but the benefits of compressing cold data can also be determined. In other words, the first threshold can be understood as a parameter used to balance computational resources and compression benefits.

[0084] The server compresses the data within a logical block by identifying the page containing the cold data from among multiple data pages within the logical block and then performing compression on that page. The timestamp of the cold data must be within the target time period. In other words, the data compressed by the server is data whose timestamp falls within the target time period.

[0085] To elaborate further, the server starts from the first data page of the multiple data pages included in the logical block, and sequentially retrieves the cold data included in each data page until the size of the cold data reaches the total data size of the multiple data pages in the target time period. If there is a compression benefit in compressing the cold data, then the compression operation is performed on the data page containing the cold data. In other words, the data page compressed by the server includes cold data and has a compression benefit. Therefore, during the compression operation, the server needs to determine the starting data page of the logical block and determine whether there is a compression benefit. This process will be explained in detail below. When compressing the data included in the logical block, the server knows the identifier of the logical block. Based on the identifier of the logical block, the server can determine the starting data page among the multiple data pages included in the logical block. There are several possible ways for the server to determine the starting data page, which will be explained below.

[0086] In some optional implementations, the server can obtain a mapping relationship between identifiers of logical blocks and data page numbers, and determine the starting data page included in the logical block based on this mapping relationship. Specifically, the server obtains a second mapping set, which includes a mapping relationship between identifiers of logical blocks and data page numbers, where one identifier of a logical block corresponds to multiple data page numbers, and one data page number uniquely corresponds to one identifier of a logical block. The server determines the starting data page included in the logical block based on this second mapping set and the identifiers of the logical blocks.

[0087] For example, the second set of correspondences can be shown in Table 2 below:

[0088] Table 2

[0089] chunk_id page_number chunk_0 page_0, page_1, ..., page_n-1 …… …… chunk_N page_Nn, page_Nn+1……page_Nn+n-1

[0090] As shown in Table 2, the data pages included in logical block chunk_0 are numbered page_0, page_1, ..., page_n-1. In the database, data page numbers are consecutive. This means that the starting data page included in logical block chunk_0 is data page_0. Based on the identifier of the logical block, the server can determine the numbers of the multiple data pages matching the identifier of the logical block from the second correspondence, thereby determining the starting data page.

[0091] It should be noted that Table 2 is merely an example of the second correspondence set. In practical applications, the second correspondence set is not limited to a table format; it can also be key-value pairs or other formats that reflect the correspondence between logical block identifiers and data page numbers. Specific limitations are not specified here. Furthermore, the second correspondence set can be stored locally on the server, in remote storage, or on other devices accessible to the server. Specific limitations are not specified here.

[0092] In some alternative implementations, the server can obtain the correspondence between a logical block and its included starting data page. Based on this correspondence and the identifier of the logical block, the server can determine the starting data page included in the logical block.

[0093] For example, assume that the relationship between the identifier of a logical block and the starting data page satisfies the following formula:

[0094] chunk_id = start - page_number × page_size ... Formula 1

[0095] Here, `chunk_id` represents the logical block identifier, `start-page_number` represents the starting data page number, and `page_size` represents the amount of data in the data page. In the database, the data page number is fixed and cannot be manually modified. The amount of data in each data page is the same, and the server can obtain this information from system parameters. Therefore, based on the logical block identifier and the data page size, combined with Formula 1, the server can determine the starting data page number of the logical block.

[0096] For example, assume that the relationship between the identifier of a logical block and the starting data page satisfies the following formula:

[0097] chunk_id=start-page_number×chunk_size...Formula 2

[0098] Here, `chunk_size` represents the amount of data in a data page. This information is defined by the user or specified by system parameters, and the server can obtain this information. Combining this with the logical block identifier and Formula 2, the starting data page number of the logical block can be determined.

[0099] In this application embodiment, the server can determine the starting data page included in the logical block in multiple ways, which enriches the implementation methods and application scenarios of the technical solution of this application. It can be selected based on the needs of actual application, thereby improving the flexibility of the technical solution.

[0100] Cold data retrieved by the server from a data page refers to the timestamp of the data read from the data page, and the time interval between that timestamp and the current time. If this time interval is greater than or equal to a time threshold, the data is determined to be cold data.

[0101] Furthermore, the server may not read all the data pages included in a logical block. This is because the server has already obtained the total size of the cold data within the logical block before reading it. Therefore, during the sequential reading of the data pages within the logical block, when the server has read enough cold data to reach the total size indicated by the attribute information, it means that the cold data within the logical block has been completely read. The data yet to be read is not cold data and does not require compression. The server does not need to read the remaining data, thus saving I / O overhead.

[0102] After acquiring cold data, the server pre-compresses it to determine if compression is beneficial. Pre-compression refers to compression at the memory level, without changing the physical form of data storage. The compression benefit is determined by comparing the storage space occupied by the cold data before and after compression. It's understandable that after compression, in addition to storing the compressed data itself, parameters used for decompression must also be stored. Therefore, the compressed data includes the compressed data and related parameters. If the storage space occupied by the compressed data is less than that occupied by the uncompressed data, then compression is considered beneficial and can be performed. Otherwise, there is no compression benefit, and the data is not compressed.

[0103] In this embodiment of the application, in the scheme for compressing the data included in the logic block, the operation of obtaining cold data stops at the scale of cold data indicated by the first attribute information, and may not traverse all data pages included in the logic block, thus saving I / O overhead. In addition, the server will only compress the cold data if it determines that the cold data has a compression benefit, which also reduces the occupation of storage space.

[0104] 304. Determine the data included in the uncompressed logical block.

[0105] In scenarios where the total size of the cold data indicated by the attribute information is less than the first threshold, it means that the cold data included in the logical block has not yet met the compression conditions, and the server will not compress the data included in the logical block. This can also be understood as keeping the data in the logical block unchanged during the current compression task.

[0106] In this embodiment, multiple data pages are mapped to logical blocks, and the decision to compress the data contained within a logical block is determined based on the block's attribute information. Specifically, the attribute information indicates the data size of the multiple data pages within the logical block at different time periods. The data within the logical block is compressed only if the total data size of the cold data in these multiple data pages is greater than or equal to a first threshold. Otherwise, the data within the logical block is not compressed. The timestamps of the cold data are located within the target time period. In other words, for logical blocks where the total data size of the cold data is less than the first threshold, no compression operation is performed, reducing I / O overhead and saving system resources.

[0107] In step 301 above, the server obtains the attribute information of the logical block. Before step 301, the server also obtains a first correspondence set and the identifier of the logical block. The first correspondence set indicates a one-to-one correspondence between the identifiers of multiple logical blocks and multiple attribute information, and the identifier of the logical block uniquely identifies the logical block. Therefore, specifically, the server obtains the attribute information of the logical block by retrieving the attribute information from the first correspondence set based on the identifier of the logical block.

[0108] Furthermore, the first correspondence set includes the correspondence between the identifiers of multiple logical blocks and multiple attribute information. Each logical block identifier uniquely corresponds to one attribute information, and each attribute information uniquely corresponds to one logical block identifier. Alternatively, it can be understood that the server maintains one attribute information for each logical block, and this attribute information can be in the form of the aforementioned histogram, system table, etc.

[0109] Optionally, the first set of correspondences can be stored locally on the server, such as in a system table or a fork file, or in the cloud, or on other devices accessible to the server.

[0110] The server also needs to obtain the identifier of the logical block. The identifier of the logical block is actually the identifier of the logical block containing the currently read data page when the server is executing the compression scheduling task. In this embodiment, there are several possible ways for the server to obtain the identifier of the logical block, which will be described below.

[0111] In some optional implementations, the server may also obtain a second mapping set, which includes a mapping between logical block identifiers and data page numbers, wherein one logical block identifier corresponds to multiple data page numbers, and one data page number uniquely corresponds to one logical block identifier. The server then obtains the number of the currently read data page. Based on the number of the currently read data page, the server determines the logical block identifier from the second mapping set.

[0112] Specifically, the server obtains the number of the currently read data page, queries the second correspondence set, and then obtains the identifier of the logical block. The specific implementation and storage location of the second correspondence set have already been described in the previous explanation of Table 2, and will not be repeated here.

[0113] In this embodiment of the application, the server can also directly determine the identifier of the logical block where the currently read data page is located based on the second correspondence set, which is simple to operate and saves computing resources.

[0114] In some optional implementations, the server obtains the number of the currently read data page, the data size of the data page, and the data size of the logical block. Based on the number of the currently read data page, the data size of the data page, and the data size of the logical block, the server determines the number of the target data page within the logical block. The target data page can be either the starting or ending data page of the logical block. Based on the number of the target data page and the target data size, the server determines the identifier of the logical block. The target data size can be either the data size of the logical block or the data size of any data page within the logical block.

[0115] Specifically, dividing a data page into multiple logical blocks involves mapping consecutive data pages to a single logical block, starting from the first data page in the database. The server can determine the number of the first data page based on system parameters. First, based on the data volume of the data page and the data volume of the logical block, the server can determine the number of data pages included in each logical block. Then, based on the number of the currently read data page, the number of data pages in each logical block, and the number of the first data page in the database, the server can determine the starting or ending data page number of the logical block containing the currently read data page. The system configuration also defines the relationship between the logical block identifier, the target data page number, and the target data volume. Using this relationship, the server can determine the identifier of the first logical block.

[0116] Optionally, the target data page is the starting data page of the logical block, and the target data volume is the data volume of the data page. That is, the relationship between the logical block identifier and the starting data page satisfies Formula 1 mentioned above. For example, based on the data volume of the logical block and the data volume of the data page, each logical block is determined to include 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages included in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the starting data page number of the third logical block is 9. If the data volume of each data page is 30MB, then the identifier of the logical block containing the currently read data page is 9 × 30 = 270.

[0117] Optionally, the target data page is the starting data page of the logical block, and the target data volume is the data volume of the logical block. That is, the relationship between the logical block identifier and the starting data page satisfies Formula 2 mentioned above. For example, based on the data volume of the logical block and the data volume of the data pages, each logical block is determined to contain 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages included in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the starting data page number of the third logical block is 9. If the data volume of the logical block is 90MB, then the identifier of the logical block containing the currently read data page is 9 × 90 = 810.

[0118] Optionally, the target data page is the last data page of the logical block, and the target data size is the data size of the data page. In other words, the relationship between the logical block identifier and the last data page satisfies Formula 3:

[0119] chunk_id=end-page_number×page_size...Formula 3

[0120] Here, `end-page_number` represents the number of the last data page. For example, based on the data size of the logical block and the data size of the data pages, each logical block is determined to contain 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the last data page of the third logical block is numbered 14. If each data page contains 30MB of data, then the identifier of the logical block containing the currently read data page is 14 × 30 = 420.

[0121] Optionally, the target data page is the last data page of the logical block, and the target data volume is the total data volume of the logical block. In other words, the relationship between the logical block identifier and the last data page satisfies Formula 4:

[0122] chunk_id = end - page_number × chunk_size ... Formula 4

[0123] For example, based on the data size of the logical block and the data size of the data page, each logical block is determined to contain 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the last data page in the third logical block is numbered 14. If each data page contains 90MB of data, then the identifier of the logical block containing the currently read data page is 14 × 90 = 1260.

[0124] In this embodiment, the target data page within the logical block containing the currently read data page is determined by the page number. This target data volume is then combined with the target data volume to determine the identifier of the logical block containing the currently read data page. The target data page can be either the starting or ending data page of the logical block; the target data volume can be either the data volume of a data page or the data volume of a logical block. This provides multiple possibilities for the implementation of the technical solution in this application, enriching the application scenarios and implementation methods.

[0125] In some optional implementations, the server obtains the number of the currently read data page and the target data volume, where the target data volume is the data volume of a logical block or the data volume of any one of multiple data pages. Based on the number of the currently read data page and the target data volume, a target identifier is determined. Then, based on the identifier corresponding to the currently read logical page and a first correspondence set, the identifier of the logical block containing the currently read data page is determined. The target identifier is the same as the identifier of the logical block containing the currently read data page, or the target identifier is less than or greater than the identifier of the logical block containing the currently read data page, and the identifier of the logical block containing the currently read data page in the first correspondence set is closest to the target identifier.

[0126] Specifically, the system configuration defines the relationship between logical block identifiers and target data volumes, which can be any of the relationships shown in Formulas 1 to 4 above. Furthermore, the first correspondence set includes identifiers for multiple logical blocks. If the target identifier determined by the server based on the number of the currently read data page and the target data volume is included in the first correspondence set, then that target identifier is the identifier of the logical block containing the currently read data page. If the target identifier is not in the first correspondence set, the server can determine the identifier of the logical block containing the currently read data page based on the target identifier and the first correspondence set. A detailed explanation follows with examples.

[0127] For example, assume the target data volume is the data volume of a data page, and the identifier of a logical block and the data volume of a data page satisfy the relationship defined in Formula 1 above. For instance, the first data page in the database is numbered 1, each logical block includes 3 data pages, and the identifiers of the logical blocks included in the first correspondence set are 10, 40, and 60. The server is currently reading data page number 5, and the data volume of the data page is 10. The server determines the target identifier to be 50. Since the identifier of a logical block and the data volume of a data page satisfy Formula 1 above, that is, the system configuration defines the identifier of a logical block based on the number of the starting data page, then the server determines from the first correspondence set that the identifier of the logical block that is smaller than the target identifier and closest to the target identifier is 40, which is the identifier of the logical block containing the currently read data page.

[0128] For example, suppose the target data volume is the data volume of a data page, and the identifier of a logical block and the data volume of a data page satisfy the relationship defined in Formula 3 above. For instance, the first data page in the database is numbered 1, each logical block includes 3 data pages, and the identifiers of the logical blocks included in the first correspondence set are 10, 40, and 60. The server is currently reading data page number 5, and the data volume of the data page is 10. The server determines the target identifier to be 50. Since the identifier of a logical block and the data volume of a data page satisfy Formula 3 above, that is, the system configuration defines the identifier of a logical block based on the number of the last data page, then the server determines from the first correspondence set that the identifier of the logical block that is larger than the target identifier and closest to the target identifier is 60, which is the identifier of the logical block containing the currently read data page.

[0129] Similarly, the target data volume is also the data volume of logical blocks, and the identifier of the logical block and the number of logical blocks satisfy the relationship defined in Formula 2 or Formula 4 above. Similar to the principles of the previous two examples, the server determines the identifier of the logical block where the currently read data page resides; this will not be elaborated upon here.

[0130] In this embodiment, the server determines a target identifier based on the number of the currently read data page and the target data volume. Then, it compares the target identifier with the identifiers of the logical blocks included in the first correspondence set to determine the identifier of the logical block containing the currently read data page. Since the relationship between the identifier of the logical block defined by the system configuration and the target data volume can be varied, there are also multiple ways for the server to determine the identifier of the logical block containing the currently read data page, enriching the application scenarios of this application's technical solution and improving its flexibility. Furthermore, this embodiment provides multiple methods for determining the identifier of the logical block containing the currently read data page, allowing for flexible selection based on actual application needs, thus enriching the implementation methods and application scenarios of this application's technical solution.

[0131] Furthermore, in this embodiment, an attribute information is maintained for each logical block, and a one-to-one correspondence between the identifiers of multiple logical blocks and the attribute information is stored in a first correspondence set. This allows the server to determine the attribute information corresponding to the logical block from the first correspondence set based on the identifier of the logical block containing the currently read data page. This provides technical support for the implementation of the technical solution of this application and improves the feasibility of the technical solution.

[0132] The preceding explanation used the compression of a single logical block as an example. In practical applications, data pages in a database may be mapped to multiple logical blocks. The following diagram illustrates this scenario.

[0133] In some alternative implementations, the server performs compression scheduling tasks serially, that is, determining one by one whether the data contained in each logical block needs to be compressed. See also... Figure 6 , Figure 6 This is a flowchart illustrating the data compression method provided in an embodiment of this application.

[0134] like Figure 6 As shown, the compression scheduling task begins. The server obtains the attribute information of the logical block containing the currently read data page and determines whether the cold data size of that logical block, as indicated by the attribute information, has reached a first threshold. If yes, the data included in that logical block is compressed. If not, it determines not to compress the data included in that logical block and obtains the attribute information of the next logical block to determine whether to compress the data included in the next logical block. This process continues until every logical block in the database has been traversed, completing the compression of the entire database.

[0135] In some optional implementations, the server can also perform compression scheduling tasks in parallel. That is, the server simultaneously judges the attribute information of multiple logical blocks corresponding to the database to determine whether to compress the data contained in multiple logical blocks. In other words, the server synchronously performs the data compression scheduling task for each logical block.

[0136] Understandably, regardless of the method, the principle behind server compression of data within a logical block is the same as described above. Figure 3 The principles described in the related embodiments are similar and will not be repeated here.

[0137] The following describes the relevant equipment provided in the embodiments of this application.

[0138] Please see Figure 7 , Figure 7 This is a schematic diagram of a data compression apparatus provided in an embodiment of this application. Figure 7 As shown, the data compression device 700 includes an acquisition unit 701 and a processing unit 702.

[0139] In some optional implementations, the acquisition unit 701 is used to acquire attribute information of a logic block, which includes multiple data pages, and the attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods.

[0140] Processing unit 702 is configured to compress the data included in the logic block and store the compressed result if the attribute information indicates that the total data size of the data included in multiple data pages in the target time period is greater than or equal to a first threshold. The target time period includes at least one of multiple time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold.

[0141] The processing unit 702 is further configured to determine that the data included in the logic block is not compressed if the attribute information indicates that the total data size of the data included in multiple data pages in the target time period is less than a first threshold.

[0142] In some optional implementations, the attribute information includes time period information and the corresponding data size information. The time period information indicates the time period in which the data's timestamp falls.

[0143] Data size information indicates the amount of data, and the first threshold includes a data size threshold. Alternatively, data size information indicates the number of data rows, and the first threshold includes a data row count threshold.

[0144] In some optional implementations, the acquisition unit 701 is further configured to: acquire a first correspondence set, wherein the first correspondence set indicates a one-to-one correspondence between the identifiers of multiple logical blocks and multiple attribute information; acquire the identifiers of the logical blocks, wherein the identifiers of the logical blocks indicate the logical blocks; and specifically, the acquisition unit 701 is configured to acquire the attribute information corresponding to the logical blocks from the first correspondence set based on the identifiers of the logical blocks.

[0145] In some optional implementations, the acquisition unit 701 is specifically used for: acquiring a second correspondence set, which includes a correspondence between logical block identifiers and data page numbers, wherein one logical block identifier corresponds to multiple data page numbers, and one data page number uniquely corresponds to one logical block identifier; acquiring the number of the currently read data page; and determining the logical block identifier from the second correspondence set based on the number of the currently read data page.

[0146] In some optional implementations, the acquisition unit 701 is specifically configured to: acquire the number of the currently read data page, the data volume of the data page, and the data volume of the logical block, wherein the currently read data page is contained within a first logical block; determine the number of a target data page in the first logical block based on the number of the currently read data page, the data volume of the data page, and the data volume of the logical block, wherein the target data page is either the starting data page or the ending data page of the first logical block; and determine the identifier of the first logical block based on the number of the target data page and the target data volume, wherein the target data volume is either the data volume of the first logical block or the data volume of any data page within the first logical block.

[0147] In some optional implementations, the acquisition unit 701 is specifically used to: acquire the number of the currently read data page and the target data volume, wherein the target data volume is the data volume of the first logical block, or the data volume of any one of multiple data pages; determine a target identifier based on the number of the currently read data page and the target data volume; and determine the identifier of the first logical block based on the identifier corresponding to the currently read logical page and a first correspondence set, wherein the target identifier is the same as the identifier of the first logical block, or the target identifier is less than or greater than the identifier of the first logical block, and the identifier of the first logical block in the first correspondence set is closest to the target identifier.

[0148] In some optional implementations, processing unit 702 is specifically configured to: obtain the data page containing cold data from multiple data pages, wherein the timestamp of the cold data is located in the target time period; and perform a compression operation on the data page containing the cold data.

[0149] Both the acquisition unit 701 and the processing unit 702 can be implemented in software or in hardware. For example, the implementation of the processing unit 702 will be described below. Similarly, the implementation of the acquisition unit 701 can be referenced to the implementation of the processing unit 702.

[0150] As an example of a software functional unit, processing unit 702 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the aforementioned computing instance may be one or more. For example, processing unit 702 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0151] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0152] As an example of a hardware functional unit, the processing unit 702 may include at least one computing device, such as a server. Alternatively, the processing unit 702 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.

[0153] The processing unit 702 includes multiple computing devices that can be distributed in the same region or in different regions. Similarly, the processing unit 702 includes multiple computing devices that can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the processing unit 702 includes multiple computing devices that can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0154] It should be noted that the data compression device 700 achieves all its functions by implementing different steps in the data compression method through the acquisition unit 701 and the processing unit 702. The data compression device 700 is used to implement the data compression method provided in the embodiments of this application, and will not be described in detail here.

[0155] Please see Figure 8 , Figure 8 This is a schematic diagram of a computing device provided in an embodiment of this application. The computing device 800 includes a processor 801, a communication interface 802, a bus 803, and a memory 804. The processor 801, the communication interface 802, and the memory 804 communicate with each other via the bus 803. In practical applications, communication can also be achieved through other means such as wireless transmission; the specific method is not limited here.

[0156] It should be understood that this application does not limit the number of processors and memories in the computing device 800.

[0157] Processor 801 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0158] The communication interface 802 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 800 and other devices or communication networks.

[0159] The 803 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 8 The bus 803 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 803 may include a path for transmitting information between various components of the computing device 800 (e.g., memory 804, processor 801, communication interface 802).

[0160] Memory 804 may include volatile memory, such as random access memory (RAM). Memory 804 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0161] The memory 804 stores executable program code, and the processor 801 executes the executable program code to implement the functions of the aforementioned acquisition unit 701 and processing unit 702, thereby realizing the data compression method. That is, the memory 804 stores instructions for executing the data compression method.

[0162] This application also provides a computing device cluster, which includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some optional embodiments, the computing device can also be a desktop computer, a laptop computer, or other terminal device.

[0163] Please see Figure 9 and Figure 10 , Figure 9 and Figure 10 These are all schematic diagrams of the computing device clusters provided in the embodiments of this application.

[0164] like Figure 9 As shown, the computing device cluster includes at least one computing device 800. The memory 804 of one or more computing devices 800 in the computing device cluster may store the same instructions for executing the data compression method provided in the embodiments of this application.

[0165] In some possible implementations, the memory 804 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the data compression method. In other words, a combination of one or more computing devices 804 can jointly execute the instructions for executing the data compression method.

[0166] It should be noted that the memory 804 in different computing devices 800 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the data compression device. That is, the instructions stored in the memory 804 of different computing devices 800 can implement the functions of one or more units among the acquisition unit 701 and the processing unit 702.

[0167] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 10 One possible implementation is shown. For example... Figure 10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this possible implementation, the memory 804 in computing device 800A stores instructions for executing the functions of the acquisition unit 701. Simultaneously, the memory 804 in computing device 800B stores instructions for executing the functions of the processing unit 702.

[0168] Figure 10 The connection method between the computing device clusters shown can be based on the data compression method provided in this application, which separates the processing operation from the operation outside the processing operation. That is, it is considered that the function of the acquisition unit 701 is executed by the computing device 800A, and the function of the processing unit 702 is executed by the computing device 800B.

[0169] It should be understood that Figure 10The functions of the computing device 800A shown can also be performed by multiple computing devices 800. Similarly, the functions of the computing device 800B can also be performed by multiple computing devices 800.

[0170] This application also provides another computing device cluster. The connection relationships between the computing devices in this computing device cluster can be similarly referred to... Figure 9 and Figure 10 The connection method of the computing device cluster will not be described in detail here.

[0171] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computer device, it causes the at least one computer device to perform the data compression method described above.

[0172] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform the aforementioned data compression method.

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

[0174] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A data compression method characterized by, The method comprises the following steps: acquiring attribute information of a logical block, the logical block comprising a plurality of data pages, the attribute information indicating data scales of data included in the plurality of data pages in a plurality of time periods, the data scales comprising data amounts or data row numbers; if the attribute information indicates that a total data scale of the data included in the plurality of data pages in a target time period is greater than or equal to a first threshold, compressing the data included in the logical block and storing a result after compression; wherein the target time period comprises at least one time period in the plurality of time periods, and a time interval between the target time period and a current time is greater than or equal to a time threshold; if the attribute information indicates that the total data scale of the data included in the plurality of data pages in the target time period is less than the first threshold, determining not to compress the data included in the logical block.

2. The method of claim 1, wherein, The attribute information comprises time period information and data scale information corresponding to the time period information; the time period information indicates a time period in which a timestamp of the data is located; the data scale information indicates a data amount, and the first threshold comprises a data amount threshold; or the data scale information indicates a data row number, and the first threshold comprises a data row number threshold.

3. The method according to claim 1 or 2, characterized in that, Before the attribute information of the logical block is acquired, the method further comprises the following steps: acquiring a first correspondence set, the first correspondence set indicating a one-to-one correspondence between identifications of a plurality of logical blocks and a plurality of attribute information; acquiring the identification of the logical block, the identification of the logical block indicating the logical block; the attribute information corresponding to the logical block is acquired from the first correspondence set according to the identification of the logical block. The identification of the logical block is acquired, comprising the following steps:

4. The method of claim 3, wherein, acquiring a second correspondence set, the second correspondence set comprising a correspondence between an identification of a logical block and a number of a data page, wherein the identification of one logical block corresponds to a plurality of numbers of data pages, and one number of a data page uniquely corresponds to one identification of a logical block; acquiring a number of a data page currently read; determining the identification of the logical block from the second correspondence set according to the number of the data page currently read. The data included in the logical block is compressed, comprising the following steps:

5. The method of any one of claims 1, 2, or 4, wherein, acquiring a data page in which cold data is located from the plurality of data pages, a timestamp of the cold data being located in the target time period; performing a compression operation on the data page in which the cold data is located. The method comprises the following steps:

6. A data compression device, characterized by, an acquisition unit is configured to acquire attribute information of a logical block, the logical block comprising a plurality of data pages, the attribute information indicating data scales of data included in the plurality of data pages in a plurality of time periods, the data scales comprising data amounts or data row numbers; a processing unit is configured to, if the attribute information indicates that a total data scale of the data included in the plurality of data pages in a target time period is greater than or equal to a first threshold, compress the data included in the logical block and store a result after compression; wherein the target time period comprises at least one time period in the plurality of time periods, and a time interval between the target time period and a current time is greater than or equal to a time threshold. ​ The processing unit is further configured to determine not to compress data included in the logical block if the attribute information indicates that a total data size of data included in the plurality of data pages in a target time period is less than the first threshold.

7. The apparatus of claim 6, wherein, The attribute information includes time period information and data size information corresponding to the time period information. The time period information indicates a time period in which a timestamp of data is located. The data size information indicates a data amount, and the first threshold includes a data amount threshold. The data size information indicates a data row number, and the first threshold includes a data row number threshold.

8. The apparatus of claim 6 or 7, wherein, The obtaining unit is further configured to: obtain a first correspondence set, the first correspondence set indicating a one-to-one correspondence between identifiers of a plurality of logical blocks and a plurality of attribute information; obtain the identifier of the logical block, the identifier of the logical block indicating the logical block; The obtaining unit is specifically configured to obtain the attribute information corresponding to the logical block from the first correspondence set according to the identifier of the logical block.

9. The apparatus of claim 8, wherein, The obtaining unit is specifically configured to: obtain a second correspondence set, the second correspondence set including a correspondence between an identifier of a logical block and a number of a data page, wherein an identifier of one logical block corresponds to a plurality of numbers of data pages, and one number of a data page uniquely corresponds to an identifier of one logical block; obtain the number of the data page currently read; determine the identifier of the logical block from the second correspondence set according to the number of the data page currently read.

10. The apparatus of any one of claims 6, 7, or 9, wherein, The processing unit is specifically configured to: obtain a data page in which cold data is located from the plurality of data pages, the timestamp of the cold data being located in the target time period; perform a compression operation on the data page in which the cold data is located.

11. A cluster of computing devices, characterized in that, The at least one computing device includes a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to implement the method of any one of claims 1 to 5.

12. A computer program product comprising instructions, characterized in that, When the instructions are executed by the computing device cluster, the method of any one of claims 1 to 5 is implemented.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer program instructions, when the computer program instructions are executed by the computing device cluster, the method of any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Data processing method, device thereof and flash-memory storage system

    CN101526923A

  • Data compression method and device

    CN109802684A