A data storage method, device, computing node and storage medium

By converting row-cached data into column-cached data and storing it in shared memory space, the problem of network bandwidth consumption for data transmission between computing nodes is solved, achieving more efficient data processing.

CN122132439APending Publication Date: 2026-06-02HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2024-12-02
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In hybrid transactional/analytic processing scenarios, transmitting column cache data between computing nodes consumes a significant amount of network bandwidth and results in low data processing efficiency.

Method used

By converting row-formatted row cache data into column-formatted column cache data and saving it to shared memory space, compute nodes can directly read data from shared memory, reducing network transmission and improving data reading speed and processing efficiency.

Benefits of technology

It saves network bandwidth resources, reduces the number of times shared memory is accessed, improves data processing speed and efficiency, and avoids errors caused by frequent data modifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122132439A_ABST
    Figure CN122132439A_ABST
Patent Text Reader

Abstract

This application provides a data storage method, apparatus, computing node, and storage medium, belonging to the field of computer technology. After acquiring row-cached data stored in row format, the computing node converts the row-cached data into column-cached data stored in column format and saves the column-cached data to a shared memory space. In OLAP or HTAP scenarios, storing and accessing data in the form of column-cached data can improve data read speed. Since the computing node saves the column-cached data to the shared memory space, another computing node can read the column-cached data from the shared memory space when using it, without needing to transfer the column-cached data between computing nodes. This saves network bandwidth resources, and because the column-cached data does not need frequent modification during data analysis, it also reduces the number of times the shared memory space is accessed. Simultaneously, the computing node can access the shared memory space through memory semantics, resulting in faster speeds, reduced latency, and improved data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data storage method, apparatus, computing node, and storage medium. Background Technology

[0002] Databases can store data in either row-based or column-based formats. Row-based data storage preserves the original data structure to a certain extent, facilitating operations such as adding, deleting, and modifying data, and is more suitable for online transaction processing (OLTP) scenarios. Column-based data storage groups data with the same fields together, facilitating subsequent data analysis, and is more suitable for online analytical processing (OLAP) scenarios.

[0003] In hybrid transactional / analytical processing (HTAP) scenarios, both storage formats must be supported simultaneously. For example, when data is stored on disk, it is stored in row format. When data analysis or other processing operations are required, the data needs to be transferred from disk to memory and stored in column format. Data stored in row format in memory can be called row cache data, and data stored in column format can be called column cache data.

[0004] Currently, in a device cluster, each compute node stores column cache data in its local memory and performs queries or analyses on the column cache data. If the first compute node needs to use the column cache data stored in the memory of the second compute node, the second compute node must transmit the column cache data to the first compute node via the network. When the amount of column cache data is large, this will consume a significant amount of network bandwidth resources. Summary of the Invention

[0005] This application provides a data storage method, apparatus, computing node, and storage medium, which can reduce the network bandwidth resources occupied during data processing and improve data processing efficiency.

[0006] Firstly, this application provides a data storage method. This data storage method can be executed by a first computing node in a device cluster, or by a chip, chip system, or circuit in the first computing node. The first computing node can be any computing node in the device cluster, and the computing node can be a computing device, computing chip, computing server, or host, or other node with computing capabilities. The method may include: the first computing node acquiring row cache data stored in row format, converting the row cache data into column cache data stored in column format, and saving the column cache data to a shared memory space, wherein the shared memory space is a memory space that allows multiple computing nodes in the device cluster to access it through memory semantics.

[0007] The data storage method provided in this application can be applied to OLAP or HTAP scenarios. In OLAP or HTAP scenarios, after the first computing node obtains the row cache data, it can convert the row cache data into column cache data for storage. During the analysis of a specific column of data, storing and retrieving data in the form of column cache data can improve the data reading speed and facilitate data analysis. The first computing node saves the column cache data to a shared memory space. When another computing node uses it, it can directly read the column cache data from the shared memory space without the need for computing nodes to transmit the column cache data over the network, which can save network bandwidth resources. Furthermore, since the column cache data does not need to be frequently modified during data analysis, the number of times the shared memory space is accessed can be reduced. At the same time, computing nodes can access the shared memory space through memory semantics, and reading data from the shared memory space is faster, reducing latency and improving data processing efficiency.

[0008] In one possible implementation, after the first compute node converts the row cache data into column cache data stored in column format, it can save the column cache data to its local memory space. When the amount of column cache data stored in the first compute node's local memory space reaches a set threshold, the column cache data stored in the first compute node's local memory space is saved to the shared memory space.

[0009] In the above implementation, when the amount of column cache data stored in the local memory space of the first computing node reaches a set threshold, the first computing node saves the column cache data stored in the local memory space to the shared memory space, instead of directly saving the column cache data obtained from each row and column transformation to the shared memory space. This can reduce the frequent synchronization between the computing node and the shared memory, and further reduce the number of times the computing node accesses the shared memory space.

[0010] In one possible implementation, if the first data in the row cache is updated, the first compute node can mark the data corresponding to the first data in the column cache stored in the shared memory space as invalid data.

[0011] In the above implementation, when it is necessary to update the column cache data stored in the shared memory space, there is no need to directly access the shared memory space to modify the column cache data. Instead, the corresponding column cache data is marked as invalid data, which can further reduce the interaction between the computing node and the shared memory.

[0012] In one possible implementation, before marking the data corresponding to the first data in the column cache data of the shared memory space as invalid data, the first compute node may send a first notification to the remaining compute nodes in the device cluster other than the first compute node; the first notification is used to prohibit the remaining compute nodes from reading the column cache data in the shared memory space. After marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data, the first compute node may send a second notification to the remaining compute nodes; the second notification is used to allow the remaining compute nodes to read the column cache data in the shared memory space.

[0013] In the above implementation, when the first compute node marks the column cache data in the shared memory space as invalid data, it sends a notification to the remaining compute nodes to prohibit reading the column cache data in the shared memory space, which can prevent the compute nodes from reading incorrect data.

[0014] In one possible implementation, multiple compute nodes in the device cluster maintain a distributed lock for the shared memory space. A first notification is used to prevent the remaining compute nodes from reading column cache data in the shared memory space by indicating that the distributed lock is in a write-locked state; a second notification is used to allow the remaining compute nodes to read column cache data in the shared memory space by indicating that the distributed lock is in an unlocked state.

[0015] In the above implementation, by controlling the distributed lock to be in a write-locked state, the remaining computing nodes are prohibited from reading column cache data in the shared memory space, which can prevent computing nodes from reading incorrect data.

[0016] In one possible implementation, the attribute information of the data corresponding to the first data is stored in the first computing node. The first computing node can modify the attribute information of the data corresponding to the first data to invalidate it, and the first computing node can send a third notification to multiple computing nodes, the third notification being used to indicate that the column cache data corresponding to the first data is invalid data.

[0017] In the above implementation, the first computing node can mark the corresponding column cache data as invalid data by modifying the attribute information of the column cache data stored in the first computing node to invalid, without having to access the shared memory space to modify the column cache data.

[0018] In one possible implementation, the first computing node can also execute the first data read instruction by using its local memory space and shared memory space as the query scope. For example, after querying, if the first computing node determines that the second data is stored in its local memory space, it reads the second data from its local memory space; if it determines that the second data is stored in the shared memory space, it reads the second data from the shared memory space.

[0019] In the above implementation, when the first computing node reads data, it uses its local memory space and shared memory space as the query scope to avoid missing the required data.

[0020] In one possible implementation, if the first computing node determines that the second data is stored in the shared memory space, it can send a fourth notification to the remaining computing nodes other than the first computing node. The fourth notification is used to prohibit the remaining computing nodes from performing the operation of marking the column cache data in the shared memory space as invalid data. After the first computing node reads the second data from the shared memory space, it can send a fifth notification to the remaining computing nodes. The fifth notification is used to allow the remaining computing nodes to perform the operation of marking the column cache data in the shared memory space as invalid data.

[0021] In the above implementation, when the first computing node reads data from the shared memory space, it can send a notification to the remaining computing nodes to prohibit reading and mark the column cache data in the shared memory space as invalid data, so as to avoid reading incorrect data.

[0022] In one possible implementation, multiple compute nodes in the device cluster store a distributed lock for the shared memory space; a fourth notification is used to prevent the remaining compute nodes from performing the operation of marking column cache data in the shared memory space as invalid data by indicating that the distributed lock is in a read-locked state; a fifth notification is used to allow the remaining compute nodes to perform the operation of marking column cache data in the shared memory space as invalid data by indicating that the distributed lock is in an unlocked state.

[0023] In the above implementation, by controlling the distributed lock to be in a read-locked state, the remaining computing nodes are prohibited from performing the operation of marking column cache data in the shared memory space as invalid data, which can prevent the first computing node from reading incorrect data.

[0024] In one possible implementation, the first compute node can also send a second data read instruction to at least two of the plurality of compute nodes. This second data read instruction instructs the at least two compute nodes to read data from the shared memory space in parallel. The first compute node can then receive the data read from the shared memory space returned by the at least two compute nodes.

[0025] In the above implementation, data can be read from the shared memory space in parallel by multiple computing nodes to further improve data reading efficiency.

[0026] Secondly, this application provides a data storage device applied to a first computing node in a device cluster; the device includes:

[0027] The row-to-column conversion module is used to obtain row cache data stored in row format and convert the row cache data into column cache data stored in column format.

[0028] The data storage module is used to save column cache data to the shared memory space; the shared memory space is a memory space that allows multiple computing nodes in the device cluster to access it through memory semantics.

[0029] In one possible implementation, the data storage module can specifically be used for:

[0030] The column cache data is saved to the local memory space of the first compute node. When the amount of column cache data stored in the local memory space of the first compute node reaches a set threshold, the column cache data stored in the local memory space of the first compute node is saved to the shared memory space.

[0031] In one possible implementation, the data storage device may further include a data update module;

[0032] The data update module is used to mark the data corresponding to the first data in the column cache stored in the shared memory space as invalid data when the first data in the row cache data is updated.

[0033] In one possible implementation, the data update module can specifically be used for:

[0034] Before marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data, a first notification is sent to the remaining compute nodes other than the first compute node among the multiple compute nodes; the first notification is used to prevent the remaining compute nodes from reading the column cache data in the shared memory space;

[0035] After marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data, a second notification is sent to the remaining compute nodes; the second notification is used to allow the remaining compute nodes to read the column cache data in the shared memory space.

[0036] In one possible implementation, multiple compute nodes in the device cluster maintain a distributed lock for the shared memory space. A first notification is used to prevent the remaining compute nodes from reading column cache data in the shared memory space by indicating that the distributed lock is in a write-locked state; a second notification is used to allow the remaining compute nodes to read column cache data in the shared memory space by indicating that the distributed lock is in an unlocked state.

[0037] In one possible implementation, the attribute information of the data corresponding to the first data is stored in the first computing node. The data update module can specifically be used to: invalidate the attribute information of the data corresponding to the first data;

[0038] The data update module can also be used to send a third notification to multiple computing nodes, which indicates that the column cache data corresponding to the first data is invalid data.

[0039] In one possible implementation, the above-mentioned data storage device may further include a data reading module, which can be used to:

[0040] Based on the first data read instruction, the local memory space and shared memory space of the first computing node are used as the query scope to execute the first data read instruction.

[0041] In one possible implementation, the data reading module can be specifically used to: read the second data from the local memory space of the first computing node when it is determined that the second data is stored in the local memory space of the first computing node; and read the second data from the shared memory space when it is determined that the second data is stored in the shared memory space.

[0042] In one possible implementation, the data reading module can also be used for:

[0043] When it is determined that the second data is stored in the shared memory space, a fourth notification is sent to the remaining computing nodes other than the first computing node. The fourth notification is used to prohibit the remaining computing nodes from performing the operation of marking the column cache data in the shared memory space as invalid data. After reading the second data from the shared memory space, a fifth notification is sent to the remaining computing nodes. The fifth notification is used to allow the remaining computing nodes to perform the operation of marking the column cache data in the shared memory space as invalid data.

[0044] In one possible implementation, multiple compute nodes in the device cluster hold a distributed lock for the shared memory space; a fourth notification is used to prevent the remaining compute nodes from performing the operation of marking column cache data in the shared memory space as invalid data by indicating that the distributed lock is in a read-locked state; a fifth notification is used to allow the remaining compute nodes to perform the operation of marking column cache data in the shared memory space as invalid data by indicating that the distributed lock is in an unlocked state.

[0045] In one possible implementation, the data reading module can also be used to: send a second data reading instruction to at least two of the multiple computing nodes, the second data reading instruction being used to instruct the at least two computing nodes to read data from the shared memory space in parallel; and receive the data read from the shared memory space returned by the at least two computing nodes.

[0046] Thirdly, this application provides a computing node including at least one processor and at least one memory; wherein the at least one memory stores one or more computer programs, the one or more computer programs including instructions that, when executed by the at least one processor, cause the computing node to perform any of the methods described in the first aspect above.

[0047] Fourthly, this application also provides a chip including a processor and a power supply circuit. The power supply circuit is used to supply power to the processor, which is used to execute a computer program to implement any of the methods described in the first aspect above.

[0048] Fifthly, this application also provides a device cluster including multiple computing nodes, each computing node including a processor and a memory; the processor of the multiple computing nodes is used to execute instructions stored in the memory of the multiple computing nodes so that the device cluster performs any of the methods described in the first aspect above.

[0049] In a sixth aspect, this application provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform any of the methods provided in the first aspect above.

[0050] In a seventh aspect, this application provides a computer program product storing instructions that, when executed by a processor, implement any of the methods provided in the first aspect.

[0051] The technical effects that can be achieved by any of the technical solutions in the second to seventh aspects mentioned above can be described with reference to the technical effects that can be achieved by the technical solution in the first aspect mentioned above, and the repeated parts will not be repeated. Attached Figure Description

[0052] Figure 1 A schematic diagram of a device cluster provided for an embodiment of this application;

[0053] Figure 2 A flowchart illustrating a data storage method provided in an embodiment of this application;

[0054] Figure 3 A schematic diagram of row cache data provided in an embodiment of this application;

[0055] Figure 4 This is a schematic diagram of column cache data provided in an embodiment of this application;

[0056] Figure 5 A flowchart illustrating another data storage method provided in this application embodiment;

[0057] Figure 6 A logical diagram illustrating a data storage process provided in an embodiment of this application;

[0058] Figure 7 A logical diagram illustrating another data storage process provided in an embodiment of this application;

[0059] Figure 8 A flowchart illustrating a data update process provided in this application embodiment;

[0060] Figure 9 An interaction diagram between nodes during a data update process is provided in an embodiment of this application;

[0061] Figure 10 This application provides another interaction diagram between nodes during a data update process, as illustrated in an embodiment of the present application.

[0062] Figure 11 This is a schematic diagram of the structure of a data storage device provided in an embodiment of this application;

[0063] Figure 12 A schematic diagram of another data storage device provided in an embodiment of this application;

[0064] Figure 13 This is a schematic diagram of the structure of a chip provided in an embodiment of this application. Detailed Implementation

[0065] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the embodiments of this application will be described in detail below with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application.

[0066] In this application embodiment, "multiple" refers to two or more. Therefore, in this application embodiment, "multiple" can also be understood as "at least two". "At least one" can be understood as one or more, such as one, two, or more. For example, "including at least one" means including one, two, or more, and it does not limit which ones are included. For example, including at least one of A, B, and C, then it could include A, B, C, A and B, A and C, B and C, or A and B and C. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / ", unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.

[0067] Unless otherwise stated, the ordinal numbers such as "first" and "second" mentioned in the embodiments of this application are used to distinguish multiple objects, and are not used to limit the order, sequence, priority or importance of multiple objects.

[0068] The data storage method provided in this application embodiment can be applied to... Figure 1 In the application scenarios shown. For example... Figure 1 As shown, the device cluster 1000 includes multiple computing nodes, such as computing node 1, computing node 2, computing node N, etc. The device cluster 1000 may include more or fewer computing nodes; this application embodiment does not limit the number of computing nodes. A computing node can be a node with computing capabilities. A computing node can also be called a computing device, computing apparatus, computing server, host, etc., and this application does not limit its usage. A computing node can take the form of a physical device with computing capabilities, or it can be a module or unit with computing capabilities deployed on a cloud platform, such as a virtual machine, control unit, etc. For example, a computing node, as a computing device, can specifically be a computing server, a desktop computer, or a controller for a storage array, etc., and this application does not limit its usage. In terms of hardware, each computing node may include a processor, memory, and a network interface card (NIC). Nodes in the device cluster 1000 can be connected to each other via a bus 30.

[0069] Taking computing node 1 as an example, computing node 1 may include at least one processor 101, memory 102, and network interface card 103. At least one processor 101, memory 102, and network interface card 103 can be interconnected via an internal bus, which can be an address bus, control bus, or data bus. For example, the internal bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc.

[0070] In this context, at least one processor 101 in computing node 1 can be one or more of the following: a central processing unit (CPU), a graphics processing unit (GPU), an application processor (AP), an image signal processing unit (ISP), a microprocessor (MP), a controller, a video codec, a baseband processor, an embedded neural network processing unit (NPU) in the field of AI, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a system-on-chip (SoC), or a complex programmable logic device (CPLD). Different processors can be independent devices, such as separate chips, or they can be integrated into the same chip.

[0071] The storage device 102 may include RAM, hard disks, and magnetic disks. Hard disks and magnetic disks have relatively slow read / write speeds and are typically used for persistent data storage. In one implementation, data, program instructions, etc., in the hard disks and magnetic disks need to be loaded into RAM first, and then the processor 101 retrieves this data and / or program instructions from RAM. Hard disks include, but are not limited to, non-volatile memory, such as read-only memory (ROM), hard disk drives (HDDs), solid-state drives (SSDs), or shingled magnetic recording hard disks.

[0072] Memory refers to the internal storage that directly exchanges data with the processor 101. The processor 101 can read and write data to the memory at any time, and the speed is very fast. It serves as temporary data storage for the operating system or other running programs running on the processor 101. Memory includes volatile memory, such as random access memory (RAM) and dynamic random access memory (DRAM), and may also include non-volatile memory, such as storage class memory (SCM), or a combination of volatile and non-volatile memory. Among them, DRAM is a semiconductor memory and, like most RAM, belongs to a type of volatile memory device. SCM is a composite storage technology that combines the characteristics of traditional storage devices and memory. Storage class memory can provide faster read and write speeds than hard drives, but its access speed is slower than DRAM, and its cost is also cheaper than DRAM. However, DRAM and SCM are only illustrative examples in this embodiment. Memory may also include other random access memories, such as static random access memory (SRAM). For read-only memory, examples include programmable read-only memory (PROM) and erasable programmable read-only memory (EPROM). Additionally, memory can also be a dual in-line memory module (DIMM), which is a module composed of DRAM.

[0073] The memory can be one or more. For example, computing node 1 may include memory corresponding to different types of processors 101. For instance, when computing node 1 includes a CPU and multiple GPUs, it also includes CPU memory corresponding to the CPU and GPU memory corresponding to each of the multiple GPUs. Alternatively, computing node 1 can be configured with multiple memory modules of different types. This application embodiment does not limit the quantity and type of memory in computing node 1. Furthermore, the user can configure the memory to have a power-saving function. A power-saving function means that when the system experiences a power outage and is then powered on again, the data stored in the memory will not be lost. Memory with a power-saving function is called non-volatile memory.

[0074] In some embodiments, memory 102 may further include a cache, which may be a static random access memory (SRAM) or the like. The cache may be located inside or outside the processor 101. For example, the processor may be located on the motherboard, and the cache may be located on the same motherboard as the processor 101. The cache may be located between the processor 101 and memory, allowing the processor 101 to read and write data to the cache at any time. Reading and writing data to the cache is faster than reading and writing data to memory. Therefore, the processor can store data in the cache before writing it to memory. The cache may include a Level 1 cache (L1), a Level 2 cache (L2), and a Level 3 cache (L3), with the processor accessing the Level 1 cache being the fastest. The processor writes data to or reads data from the cache or memory at a cacheline granularity. A cacheline granularity can be 64 bytes, meaning the processor can write 64 bytes of data to or read 64 bytes of data from the cache or memory at a time.

[0075] Compute node 1 is equipped with a bus interface 103, and bus 30 is connected to bus interface 130, enabling compute node 1 to connect to other compute nodes in the device cluster via bus 30. Bus 30 can be a memory interconnect bus, which is a set of communication lines connecting compute nodes. The memory interconnect bus is responsible for the transmission of data and control signals between compute nodes, providing high-bandwidth, low-latency, and consistent connections for multiple nodes. For example, the memory interconnect bus can be a bus based on the Compute Express Link (CXL) protocol or a unified bus (UB).

[0076] In some application scenarios, compute node 1 may also include a network interface card (NIC). The NIC in compute node 1 is used to communicate with other nodes (such as compute node 2, compute node N, etc.) over a network. For example, in OLAP or HTAP scenarios, when data is stored on a hard disk, it is stored in row format. When compute node 1 needs to perform data analysis or other processing operations, it needs to transfer the data from the hard disk to memory and store it in column format in memory. Data stored in memory in row format can be called row cache data, and data stored in column format can be called column cache data. When compute node 2 or other compute nodes need to use the column cache data stored in the memory of compute node 1, compute node 1 can transfer the column cache data to compute node 2 or other compute nodes through NIC 103.

[0077] To avoid consuming excessive network bandwidth resources when transmitting column cache data between computing nodes via network cards, the computing nodes in the device cluster of this application embodiment can save the column cache data to a shared memory space.

[0078] Exemplarily, in some embodiments, the device cluster may further include a shared memory pool 20. The shared memory pool 20 is a memory resource pool shared by multiple computing nodes in the device cluster, and is a memory space accessible to all computing nodes. The shared memory pool 20 can be managed by a shared memory manager, and each computing node can first obtain shared memory space from the shared memory pool 20 before using it. Any computing node in the device cluster 1000 can access the shared memory pool 20. In some embodiments, the shared memory pool 20 may be a memory space jointly composed of the memory of multiple computing nodes in the device cluster 1000. In some embodiments, the shared memory pool 20 may be provided by a separate storage device capable of providing high-bandwidth, low-latency data read / write memory access operations, and the storage device may be independent of the multiple computing nodes in the device cluster 1000. This application embodiment does not limit the form of shared memory. In this application embodiment, the computing nodes of the device cluster 1000 can access the shared memory pool 20 through the bus 30. Through bus 30, nodes can access shared memory across nodes using memory semantics as if it were local memory. Memory semantics, also known as Load / Store semantics, refers to the read / write instructions used to access local memory.

[0079] Before using the shared memory space, compute node 1 in the device cluster can send a shared memory request to the shared memory manager. Upon receiving the shared memory request from compute node 1, the shared memory manager can allocate shared memory space for compute node 1 from the free memory resources of the shared memory pool 20 and feed back the address information of the shared memory space to compute node 1. In one embodiment, when the shared memory pool 20 contains the memory resources of multiple compute nodes in the device cluster 1000, the shared memory manager, upon receiving the shared memory request from compute node 1, can determine the target compute node from among the compute nodes with free memory resources and send a memory allocation request to the target compute node. The target compute node can allocate shared memory space for compute node 1 from the free memory resources based on the received memory allocation request and feed back the address information of the shared memory space to compute node 1 through the shared memory manager.

[0080] In other embodiments, a management node is provided in the device cluster. Before using the shared memory space, compute node 1 can send a shared memory request to the management node. Upon receiving the shared memory request from compute node 1, the management node can determine a target compute node from among multiple nodes to provide shared memory space to compute node 1, based on the memory ratio configuration of multiple compute nodes in the device cluster and the current free memory space of multiple compute nodes. The memory ratio configuration of any compute node in the device cluster indicates the maximum proportion of shared memory space that any compute node can provide relative to its memory resources. For example, assuming that the memory ratio configuration of compute node 2 in the device cluster is 60%, it means that compute node 2 can provide a maximum of 60% of its memory resources as shared memory space. When the current free memory space of compute node 2 accounts for 80% of its memory resources, compute node 2 can provide a maximum of 60% of its memory resources as shared memory space. After determining the target compute node, the management node can send a memory allocation request to the target compute node. The target compute node can allocate shared memory space for compute node 1 from free memory resources based on the received memory allocation request, and feed back the address information of the shared memory space to compute node 1 through the management node. After compute node 1 obtains the shared memory space, it can use the shared memory space.

[0081] In this embodiment, compute node 1 in the device cluster can, after acquiring row-formatted cache data, convert it into column-formatted cache data and save it to the shared memory space. The following explanation uses the shared memory space requested by compute node 1 from the shared memory pool as an example. Multiple compute nodes in the device cluster can access this shared memory space through memory semantics. These multiple compute nodes may be compute nodes that jointly execute the same task or related tasks with compute node 1 and need to share the shared memory space. In the above process, the compute node converts the row-formatted cache data into column-formatted cache data for storage, which improves the data reading speed during data analysis and is more conducive to data analysis. When another compute node uses the shared memory space, it can directly read the column-formatted cache data without the need for network transmission between compute nodes, saving network bandwidth resources. Furthermore, since the column-formatted cache data does not need frequent modification during data analysis, the number of times the shared memory space is accessed is reduced. Meanwhile, computing nodes can access shared memory space through memory semantics, read data from shared memory space faster, reduce latency, and improve data processing efficiency.

[0082] Figure 2 The flowchart of a data storage method provided in an embodiment of this application is illustrated by way of example. This data storage method can be... Figure 1 This can be executed on any one of the compute nodes in the device cluster shown. The following explanation uses compute node 1 (also known as the first compute node) as an example. Figure 2 As shown, the method may include the following steps:

[0083] S201, compute node 1 obtains row cache data stored in row format.

[0084] For example, the data storage method provided in this application embodiment can be applied to scenarios where computing nodes in a device cluster analyze data in a database. The data in the database can be stored on the hard drive of the computing node, where the data is stored in row format. For example, in an HTAP scenario, if a user needs to query or analyze data in certain columns, data stored in column format is more conducive to data analysis. In this case, the user's client can send a data processing request to the device cluster. A computing node in the device cluster can act as a request node to execute the data processing request. Upon receiving the data processing request from the user's client, the request node can generate a row-column transformation request based on the data processing request. The request node can be any computing node in the device cluster, or it can be computing node 1. In one embodiment, the request node can generate a row-column transformation request executed by a single computing node; for example, computing node 1 can execute the row-column transformation request independently. In another embodiment, the request node can generate a row-column transformation request executed collaboratively by multiple computing nodes; for example, computing node 1 and computing node 2 (also referred to as the second computing node), or more computing nodes, can jointly execute the row-column transformation request. After the requesting node generates a row-column transformation request, it sends the row-column transformation request to the corresponding compute node.

[0085] When compute node 1 receives a row-to-column transformation request, it can read data stored in row format from the database based on this request. This row-based storage method is called row-based storage. Compute node 1 can store the row-based data in its memory, resulting in row-cached data. For example, suppose the database contains health data for a class of students. This data is tabular, with each row representing data for one student and each column representing data for a specific examination item, such as height, weight, left eye vision, and right eye vision. This data is stored in row format in the database and read into compute node 1's memory, resulting in row-cached data. Figure 3 As shown.

[0086] In one embodiment, if the row-column transformation request received by compute node 1 is a row-column transformation request executed by a single compute node, compute node 1 can read all the required data from the database and store it in its memory as row cache data. In another embodiment, if the row-column transformation request received by compute node 1 is a row-column transformation request executed collaboratively by multiple compute nodes, compute node 1 can filter and read the required partial data from the database and store it in its memory as row cache data. The remaining data can be row-column transformed by other compute nodes.

[0087] S202, compute node 1 converts row cache data into column cache data.

[0088] Storing data in column format is called column-based storage. Compute node 1 converts data stored in row format to data stored in column format and stores it in memory; this process can be called row-to-column conversion. For example, after retrieving row cache data, compute node 1 can read the data in the first column of each row sequentially from the row cache data, arranging the data in the first column of each row contiguously according to the row order, that is, arranging the data in the first column of the row cache data consecutively, to obtain the first column unit (CU), also called an in-memory column unit (IMCU). Then, it reads the data in the second column of each row sequentially, arranging the data in the second column of each row contiguously according to the row order, that is, arranging the data in the second column of the row cache data consecutively, to obtain the second column unit, and so on, converting the row cache data to column format. Figure 4 The column shown is cached data.

[0089] S203, compute node 1 saves the column cache data to the shared memory space.

[0090] The shared memory space can be the memory space requested by compute node 1 from the shared memory, or the memory space that multiple compute nodes in the device cluster can access through memory semantics. The multiple compute nodes can be compute nodes that execute the above data processing requests.

[0091] In this embodiment, multiple computing nodes in the device cluster can access the shared memory space and read column cache data from it. When one computing node needs to use column cache data converted by another computing node, it can directly read the column cache data from the shared memory without the need for computing nodes to transmit the column cache data over the network, thus saving network bandwidth resources. Furthermore, since the column cache data does not need to be frequently modified during data analysis, the number of times the shared memory space is accessed can be reduced.

[0092] For a single compute node, in this embodiment, the shared memory of the device cluster can be used to store the column cache data of that compute node. Compared to using only the memory of the compute node to store the column cache data, the shared memory has a larger storage space, allowing the memory resources of the device cluster to be utilized to store more column cache data, so that the capacity of the column cache data is no longer limited by the memory limit of a single compute node. Furthermore, since all the column cache data of the compute node is stored in shared memory, data skew can be avoided. Data skew refers to the phenomenon where one compute node handles more data analysis tasks and stores a lot of column cache data in memory, while another compute node handles less data analysis tasks and stores very little column cache data in memory, resulting in a large difference in the storage pressure on the memory of different compute nodes.

[0093] The data storage process of this application will be described in detail below through a specific embodiment. The example will still be taken as computing node 1. Figure 5 As shown, the process may include the following steps:

[0094] S501, compute node 1 obtains row cache data stored in row format.

[0095] Compute node 1 in acquiring Figure 3 After storing the row cache data in row format as shown, the row cache data can be saved in the local memory space of compute node 1.

[0096] S502, compute node 1 converts row cache data into column cache data and saves it to the local memory space of compute node 1.

[0097] In some embodiments, before storing the column cache data on compute node 1, a storage space for storing the column cache data can be allocated in local memory. For example, this storage space can be a first memory space. For instance, when compute node 1 starts a first thread, the first thread is used to execute data analysis tasks or row-column transformation tasks. Here, a thread can be a running activity of a program on the compute node, and is the basic unit for resource allocation and scheduling on the compute node. From the user's perspective, a thread is the execution process of a program on the compute node. From the perspective of the compute node itself, a thread is a program running on the compute node. When the first thread performs row-column transformation, it can save the transformed column cache data to the first memory space. The first memory space can be the memory space allocated by compute node 1 for the first thread. The column cache data stored in the first memory space can be called active rowgroup data, meaning that the column cache data in the first memory space can be added to, or the column cache data in the first memory space can be modified.

[0098] Compute node 1 can convert row cache data into Figure 4 The column cache data shown is stored in column format, and the column cache data is saved to the first memory space.

[0099] S503, compute node 1 determines whether the amount of column cache data stored in the local memory space of compute node 1 has reached the set threshold; if yes, then execute step S504; if no, then return to execute step S501.

[0100] The threshold can be determined based on the capacity of the local memory space of computing node 1, i.e., the first memory space. The capacity of the first memory space is proportional to the capacity of the memory space used to store row cache data. The first memory space is used to store multiple CUs or IMCUs generated after the conversion of multiple row cache data. The amount of column cache data stored in the first memory space can be counted in rows. The threshold can be the maximum batch row size. If the number of rows (rowsize) corresponding to the column cache data stored in the first memory space does not reach the set maximum batch row size, then the amount of data in the first memory space has not reached the set threshold, and the process can return to step S501 to continue reading more data stored in row format and saving it as row cache data. If the number of rows corresponding to the column cache data stored in the first memory space reaches the set maximum batch row size, then the amount of data in the first memory space has reached the set threshold, and step S504 can be executed.

[0101] S504, compute node 1 saves the column cache data stored in compute node 1's local memory space to the first shared memory space.

[0102] like Figure 6 As shown, when the column cache data stored in the local memory space of compute node 1, i.e., the first memory space, reaches a set threshold, the column cache data stored in the first memory space can be saved to the first shared memory space. The set of column cache data saved to the first shared memory space is used as the first dataset. The first dataset is immutable rowgroup data, where immutable rowgroup data means that no new CUs or IMCUs are added to the first dataset, and the data in the first dataset is no longer subject to changes.

[0103] For example, each compute node in the device cluster is equipped with a shared memory manager. The shared memory managers across multiple compute nodes are periodically synchronized. The shared memory manager can be understood as a software program running on the compute node. The first thread in compute node 1 can request a first shared memory space from the shared memory manager in compute node 1 through the shared memory request interface shm_create(size). Here, size is used to characterize the size of the requested first shared memory space. Size can be determined based on the amount of column cache data stored in the first memory space. For example, size can be a set threshold. The shared memory manager allocates the first shared memory space for the column cache data, and compute node 1 determines the address of the first shared memory space.

[0104] The local memory of compute node 1 stores the row group information of the first dataset. The first thread in compute node 1 obtains the address of the first shared memory space and maps the address of the first shared memory space to the row group information of the first dataset through the mapping interface shm_mmap(). The first thread in compute node 1 saves the column cache data of the first dataset to the first shared memory space through the data flushing interface shm_flush().

[0105] In this embodiment of the application, when the amount of column cache data stored in the first memory space reaches a set threshold, the computing node 1 saves the column cache data stored in the first memory space to the first shared memory space, instead of directly saving the column cache data obtained from each row and column transformation to the shared memory. This can reduce the frequent synchronization between the computing node and the shared memory and reduce the number of times the computing node accesses the shared memory.

[0106] S505, compute node 1 broadcasts row group information of column cache data stored in the first shared memory space.

[0107] The column cache data stored in the first shared memory space is the aforementioned first dataset, and the row group information of the first dataset is stored in compute node 1. For example... Figure 6 As shown, the row group information of the first dataset includes the addresses of the column cache data in the first shared memory space. The row group information of the first dataset stores the addresses of the column cache data in the first shared memory space using shared memory pointers. Within the row group information of the first dataset, for each column cache data, the mapping between its virtual address and physical address is stored. The virtual address indicates the position of the column cache data in the table, representing the row and column number corresponding to that column cache data; the physical address indicates the address of the column cache data in the first shared memory space.

[0108] After saving the first dataset to the first shared memory space, compute node 1 can acquire the distributed lock for the first dataset. For example, the first thread in compute node 1 requests the identifier of the first dataset and the distributed lock from the shared memory manager. The identifier of the first dataset can be called RowGroupID, which is a unique identifier distinguishing it from other datasets in the device cluster; for example, the identifier of the first dataset could be Group1.

[0109] The distributed lock for the first dataset is used to prevent other compute nodes in the device cluster from reading column cache data in the first dataset when any compute node in the device cluster marks it as invalid. The distributed lock for the first dataset can also be used to prevent other compute nodes in the device cluster from marking column cache data in the first dataset as invalid when any compute node in the device cluster is reading it, thus avoiding read-write conflicts and preventing compute nodes in the device cluster from reading incorrect column cache data. The distributed lock for the first dataset can be understood as a status flag of the first dataset stored in a register, which can include three states: read-locked, write-locked, and unlocked. Specifically, when the distributed lock for the first dataset is in the write-locked state, compute nodes in the device cluster are prohibited from reading column cache data in the first dataset; when the distributed lock for the first dataset is in the read-locked state, compute nodes in the device cluster are prohibited from performing the operation of marking column cache data in the first dataset as invalid; when the distributed lock for the first dataset is in the unlocked state, compute nodes in the device cluster are allowed to read column cache data in the first dataset or perform the operation of marking column cache data in the first dataset as invalid.

[0110] The first thread in compute node 1 can save the distributed lock of the first dataset to the row group information of the first dataset, and use the identifier of the first dataset as the identifier of the row group information.

[0111] The row group information of the first dataset includes attribute information of the column cache data in the first dataset. For example, the row group information of the first dataset stores the attribute information of the column cache data in the first dataset using a bitmap. The attribute information of any column cache data is used to mark whether the corresponding column cache data is valid or invalid data. In some embodiments, the column cache data can be in units of CUs or IMCUs, and the row group information of the first dataset includes attribute information of multiple CUs or multiple IMCUs. Since the column cache data changes in an append-only manner, the constructed column cache data does not change further. Therefore, if a column cache data needs to be updated, the constructed column cache data is marked as invalid data, and then new column cache data is added to save the updated data. Invalid data indicates that the corresponding column cache data has been deleted. Deleted column cache data is invisible to the compute nodes; the compute nodes can only read valid data.

[0112] Compute node 1 can broadcast the row group information of the first dataset to other compute nodes in the device cluster. This information includes the identifier of the first dataset, its distributed lock, and a shared memory pointer. The shared memory pointer points to the address of the column cache data in the first shared memory space. Other compute nodes in the device cluster receive the row group information broadcast by compute node 1, store it in their local memory, and can access the first shared memory space based on the shared memory pointer in the row group information to read the column cache data. This ensures that the column cache data is transparent to any compute node in the device cluster. Figure 7 As shown, compute node 1 shares the row group information of the first dataset with compute nodes 2 and 3. Compute nodes 2 and 3 store the row group information of the first dataset in their local memory and can access the first shared memory space based on the shared memory pointer in the row group information of the first dataset to read the column cache data in the first dataset. For the first dataset, compute nodes 2 and 3 are the readers, and compute node 1 is the writer.

[0113] Column cache data can be used in data analysis processes where data modification is rare. However, in some implementations, users may still require data modification. When a user modifies the data, the corresponding row cache data is updated. When the row cache data is updated, compute node 1 can... Figure 8 The process shown updates the column cache data. For example... Figure 8 As shown, the process may include the following steps:

[0114] S801, when compute node 1 updates the first data in the row cache data, it generates an update log for the first data.

[0115] The update log for the first data item records that the first data item in the row cache has been updated. This update log also includes the identifier of the dataset to which the corresponding column cache data belongs. The update log can also be called the write-ahead log (WAL). To ensure the persistence and consistency of data modifications, the WAL log is saved in chronological order to guarantee the persistence of in-memory page modifications. During row-to-column transformations, the replay of the WAL log ensures that updates and modifications to the column cache data are synchronized with those to the row cache data.

[0116] For example, when a user needs to modify data, the user's client can send a data modification request to the device cluster. Upon receiving the data modification request from the user's client, the request node in the device cluster can generate a data update request based on the request and send it to the corresponding compute node. Suppose it is necessary to update the first data in the row cache data stored in compute node 1. The request node can send a data update request to compute node 1, instructing that the first data in the row cache data be updated. Compute node 1 updates the first data in the row cache data based on the received data update request. For example, compute node 1 can update the first data in the row cache data through a second thread and generate an update log for the first data, which is stored in an incremental table, awaiting subsequent log replay by a third thread. This does not affect the second thread in compute node 1 from continuing to perform other operations, ensuring the efficiency of the compute node in processing user requests.

[0117] S802, compute node 1 determines, based on the update log of the first data, that the column cache data corresponding to the first data belongs to the first dataset.

[0118] Compute node 1 can perform log replay through a third thread, which can be a merge thread. When replaying the update log of the first data, the identifier of the dataset to which the column cache data corresponding to the first data belongs is obtained from the update log of the first data. The identifier of the dataset can be a number. Compute node 1 can traverse all datasets based on the identifier of the dataset in the update log of the first data to determine the dataset to which the column cache data corresponding to the first data belongs, and finally determine that the column cache data corresponding to the first data belongs to the first dataset.

[0119] S803, compute node 1 determines whether the first dataset is stored in the first shared memory space; if yes, then execute step S805, if no, then execute step S804.

[0120] Computation node 1 can determine whether the first dataset is stored in local memory or in the first shared memory space. If it is stored in local memory, proceed to step S804; if it is stored in the first shared memory space, proceed to step S805.

[0121] S804, Compute node 1 modifies the column cache data corresponding to the first data in the first dataset.

[0122] In some embodiments, if compute node 1 determines that the first dataset is stored in local memory, compute node 1 can directly modify the column cache data corresponding to the first data in the first dataset. In other embodiments, compute node 1 stores the row group information of the first dataset in its memory. If compute node 1 determines that the first dataset is stored in local memory, compute node 1 can mark the attribute information of the column cache data corresponding to the first data as invalid in the row group information of the first dataset, and add new column cache data to the first dataset to store the updated first data.

[0123] S805, compute node 1 broadcasts a first notification, which is used to prohibit compute nodes in the device cluster from reading column cache data in the first dataset.

[0124] The first notification can be a write lock notification, which indicates that the distributed lock of the first dataset is in a write-locked state to prevent the compute nodes in the device cluster from reading the column cache data in the first dataset.

[0125] If compute node 1 determines that the first dataset is stored in the shared memory space, it can broadcast a write lock notification to other compute nodes in the device cluster. The write lock notification indicates that the distributed lock of the first dataset is in a write-locked state. The write-locked state is used to instruct the compute nodes that receive the write lock notification to prohibit reading the column cache data in the first dataset.

[0126] S806, compute node 1 marks the column cache data corresponding to the first data in the first dataset as invalid data based on the update log of the first data.

[0127] After the distributed lock of the first dataset is in a write-locked state, the third thread in compute node 1 can modify the row group information of the first dataset using data manipulation language (DML). In the row group information of the first dataset stored by compute node 1, the attribute information of the column cache data corresponding to the first data is marked as invalid. Compute node 1 can also broadcast a synchronization modification notification to other compute nodes in the device cluster, indicating that the column cache data corresponding to the first data is invalid. For example, compute node 2, upon receiving the synchronization modification notification broadcast by compute node 1, can mark the column cache data corresponding to the first data as invalid based on the synchronization modification notification. For example, compute node 2 can mark the attribute information of the column cache data corresponding to the first data as invalid in the row group information of the first dataset stored by compute node 2.

[0128] Compute node 1 can add new column cache data in its local memory space, i.e., the first memory space, to store the updated first data. The step of adding new column cache data can also be performed after step S807.

[0129] The above process describes how compute node 1 updates the column cache data in the shared memory space. During this process, compute node 1 does not need to access the shared memory, does not consume the shared memory's read / write bandwidth, and does not affect the access speed of other nodes to the shared memory, thus improving the data query performance of the device cluster.

[0130] S807, compute node 1 broadcasts a second notification, which allows compute nodes in the device cluster to read column cache data from the first dataset.

[0131] The second notification can be an unlock notification, which indicates that the distributed lock of the first dataset is in an unlocked state, allowing the compute nodes in the device cluster to read the column cache data in the first dataset.

[0132] After compute node 1 completes the update of the column cache data corresponding to the first dataset, it can broadcast an unlock notification to other compute nodes in the device cluster. The unlock notification indicates that the distributed lock of the first dataset is in an unlocked state. Any compute node in the device cluster that receives the unlock notification broadcast by compute node 1 can read the column cache data in the first dataset as needed.

[0133] When a compute node reads data from the first dataset, a distributed lock on the first dataset can prevent other compute nodes from updating the column cache data in the first dataset. For example, when compute node 2 in the device cluster needs to read the column cache data in the first dataset, compute node 2 can broadcast a read lock notification to the compute nodes in the device cluster. The read lock notification indicates that the distributed lock on the first dataset is in a read-locked state. When compute node 1 receives the read lock notification broadcast by compute node 2, it stops the operation of marking the column cache data in the first dataset as invalid data. After broadcasting the read lock notification to the compute nodes in the device cluster, compute node 2 can access the first shared memory space to read the column cache data in the first dataset. After reading, it can broadcast an unlock notification to the compute nodes in the device cluster. The unlock notification indicates that the distributed lock on the first dataset is in an unlocked state. When compute node 1 receives the unlock notification broadcast by compute node 2, it can continue the operation of marking the column cache data in the first dataset as invalid data based on the update log.

[0134] When compute node 1 updates column cache data, it can modify the row group information of the column cache data stored in compute node 1 without accessing the shared memory space. Modifying the data stored in the shared memory space can reduce the number of times the shared memory space is accessed and reduce data update latency.

[0135] It should be noted that after saving the first dataset to the first shared memory space, compute node 1 can clear its local memory space, i.e., the first memory space. Compute node 1 can then continue performing row-column transformations, saving the transformed column cache data to the first memory space. When the column cache data stored in the first memory space reaches a set threshold again, the column cache data stored in the first memory space can be saved to the first shared memory space. This portion of the column cache data can then be used as the second dataset, and so on.

[0136] The above process is illustrated using the example of compute node 1 in the device cluster performing row-column conversion. Other compute nodes in the device cluster can also refer to the above steps when performing row-column conversion. For example, compute node 2 in the device cluster can refer to the above steps to save a third dataset to the first shared memory space. The third dataset includes column cache data stored in column format. Compute node 2 can be understood as any compute node in the device cluster.

[0137] In some embodiments, after saving the first dataset, the second dataset, etc., to the first shared memory space, compute node 1 can read column cache data from the first shared memory space. For example, when compute node 1 needs to read data, it can generate a data read instruction; alternatively, when compute node 1 receives a data read instruction from another compute node, it can perform a data read operation based on the data read instruction, using its local memory space and the first shared memory space as the query scope, to determine whether the second data indicated by the data read instruction is stored in compute node 1's local memory space or in the first shared memory space. The local memory space of compute node 1 is the aforementioned first memory space.

[0138] For example, the data read instruction carries the virtual address of the second data to be read. Based on the correspondence between the virtual and physical addresses of data stored in compute node 1, the virtual address of the second data is converted to its physical address. Compute node 1 can search for this physical address in its local memory space. If the physical address is located in compute node 1's local memory space, compute node 1 can determine that the second data is stored in its local memory space, which stores column cache data that has not yet been saved to the first shared memory space. If the physical address is not found in compute node 1's local memory space, compute node 1 can search for it in the first shared memory space. If the physical address is located in the first shared memory space, compute node 1 can determine that the second data is stored in the first shared memory space. If it is determined that the second data is stored in the local memory space of the first compute node, compute node 1 can read the second data from its local memory space. If it is determined that the second data is stored in the first shared memory space, compute node 1 can read the second data from the first shared memory space.

[0139] When compute node 1 reads the second data from the first shared memory space, compute node 1 can broadcast a fourth notification to the compute nodes in the device cluster. This fourth notification prohibits the compute nodes in the device cluster from marking the column cache data in the first shared memory space as invalid. After reading the second data from the shared memory space, compute node 1 can send a fifth notification to the compute nodes in the device cluster. This fifth notification allows the remaining compute nodes to mark the column cache data in the first shared memory space as invalid. The fourth notification can be an indication that the distributed lock on the first dataset is in a read-locked state, and the fifth notification can be an indication that the distributed lock on the first dataset is in an unlocked state.

[0140] Any compute node in the device cluster can access the column cache datasets stored in shared memory, including the first, second, and third datasets mentioned above. The following explanation uses compute node 2 in the device cluster accessing the first dataset stored in shared memory and reading the column cache data from it as an example.

[0141] When a user needs to analyze data in certain columns, their client can send a data processing request to the device cluster. Upon receiving the request, the requesting node in the device cluster, after confirming the row and column transformation is complete, can perform data processing based on the obtained column cache data, determine the analysis results, and then send the results back to the user's client. The following explanation uses compute node 3 (also known as the third compute node) in the device cluster as an example.

[0142] In one embodiment, computing node 3 can determine the analysis result by performing the analysis process as a single computing node. To accelerate the data reading rate, multiple computing nodes can read the column cache data required by computing node 3 in parallel, and then computing node 3 can perform data processing. Figure 9 As shown, the interaction process between computing node 1, computing node 2, and computing node 3 in this process may include the following steps:

[0143] S901, compute node 3 sends a data read command to compute node 2.

[0144] When a user needs to analyze data in a specific column, their client can send a data processing request to the device cluster. Let's assume this request instructs the user to perform an addition operation on the first column of data in rows 1-300. Computing node 3 in the device cluster receives the request, divides the data to be read into multiple groups, generates a multi-machine parallel query plan, and reads the data in parallel across multiple computing nodes. For example, suppose a first dataset in a first shared memory space contains data from rows 1-100, a second dataset in a first shared memory space contains data from rows 101-200, and a third dataset in a first shared memory space contains data from rows 201-300. Compute node 3 can divide the data to be read into multiple groups using a shared memory scan operator. For example, the data in the first column of rows 1-300 to be read can be divided into three groups: the first group is the data in the first column of rows 1-100, the second group is the data in the first column of rows 101-200, and the third group is the data in the first column of rows 201-300. Each group of data corresponds to a virtual address. Compute node 3 generates multiple data read instructions and sends them to different compute nodes. Each data read instruction carries the virtual address of the data to be read. Compute nodes 1, 2, and 3 can query the data in parallel based on their respective data read instructions. For example, compute node 2 is used to read the data in the first column of rows 1-100 of the first dataset, compute node 3 is used to read the data in the first column of rows 101-200 of the second dataset, and compute node 1 is used to read the data in the first column of rows 201-300 of the third dataset.

[0145] Computing node 3 sends data read commands to both computing node 2 and computing node 1. Simultaneously, computing node 3 performs the operation of reading the first column of rows 101-200 from the second dataset in the first shared memory space. Computing nodes 2 and 1 can perform the same steps upon receiving the data read commands; this embodiment uses computing node 2 as an example for explanation.

[0146] S902, Compute node 2 broadcasts a read lock notification.

[0147] Computing node 2 receives a data read instruction from computing node 3 and, in response, broadcasts a read lock notification to multiple computing nodes in the device cluster. The data read instruction instructs computing node 2 to read the first column data from rows 1 to 100. In some embodiments, computing node 2 can read data belonging to the first column data from rows 1 to 100 from a first shared memory space. In other embodiments, computing node 2 first reads the data belonging to the first column data from rows 1 to 100 stored in its local memory, and then reads the data belonging to the first column data from rows 1 to 100 from the first shared memory space. The first column data from rows 1 to 100 stored centrally in the first dataset is referred to as the fourth data. Before reading the fourth data in the first dataset based on the data read instruction, computing node 2 can broadcast a read lock notification to multiple computing nodes in the device cluster. The read lock notification indicates that the distributed lock of the first dataset is in a read-locked state. The read-locked state is used to instruct computing nodes that receiving the read lock notification to prohibit marking the column cache data in the first dataset as invalid data. The following explanation uses computing node 1 as an example.

[0148] S903, compute node 1 stops executing the operation of marking column cache data in the first dataset as invalid data based on the received read lock notification.

[0149] Step S903 above is an optional step. When compute node 1 receives the read lock notification broadcast by compute node 2, if there is data in the first dataset that needs to be updated, it will not perform the operation of marking the column cache data in the first dataset as invalid data, but will wait to receive the unlock notification before performing the operation of marking the column cache data in the first dataset as invalid data.

[0150] S904, compute node 2 reads the fourth data from the first dataset.

[0151] Computing node 2 can scan the first shared memory space using a shared memory scanning operator based on the virtual address carried in the received data read instruction and the row group information of the first dataset stored in the memory of computing node 2, and read the fourth data from the first dataset.

[0152] S905, Compute Node 2 broadcasts an unlock notification.

[0153] After reading the fourth data based on the data read instruction, compute node 2 can broadcast an unlock notification to multiple compute nodes in the device cluster. The unlock notification indicates that the distributed lock of the first dataset is in an unlocked state, and the operation of marking the column cache data in the first dataset as invalid data can be performed.

[0154] S906, compute node 1 performs an operation to mark column cache data in the first dataset as invalid data based on the update log.

[0155] Step S906 above is an optional step. If there is an update log in compute node 1 involving column cache data in the first dataset, compute node 1 can continue to perform the operation of marking the column cache data in the first dataset as invalid data based on the update log.

[0156] S907, compute node 2 sends the read data to compute node 3.

[0157] After reading the fourth data from the first shared memory space based on the data read instruction, compute node 2 sends the fourth data along with the data read from compute node 2's memory to compute node 3.

[0158] In some embodiments, step S907 may be performed before step S905. The execution order between the steps is not limited in the embodiments of this application.

[0159] S908, computing node 3 performs data analysis based on the received data to obtain the target analysis results.

[0160] Suppose the data processing request instructs that an addition operation be performed on the first column of data in rows 1-300. Compute node 3 receives the first column of data in rows 1-100 returned by compute node 2. Compute node 1 receives the data read instruction sent by compute node 3 and, following the steps of compute node 2 reading column cache data, reads the first column of data in rows 201-300 and sends it to compute node 3. Compute node 3 receives the first column of data in rows 201-300 returned by compute node 1. Compute node 3 then reads the first column of data in rows 101-200 from its local memory and the first shared memory space. The steps for compute node 3 to read column cache data from the first shared memory space can be performed following the steps for compute node 2 to read column cache data from the first shared memory space, and will not be repeated here. At this point, compute node 3 has obtained the first column of data in rows 1-300, and can perform an addition operation on this data to obtain the target analysis result, which is then sent to the user's client.

[0161] In this embodiment of the application, multiple computing nodes can read data from shared memory in parallel through shared memory operators, which can improve the data reading and data query performance of the device cluster.

[0162] In another embodiment, computing node 3 can determine the analysis results by distributing the analysis process across multiple computing nodes. By having multiple nodes jointly execute the data analysis process, processing efficiency can be further improved. Figure 10 As shown, the interaction process between computing node 1, computing node 2, and computing node 3 in this process may include the following steps:

[0163] S1001, Computing node 3 sends a data processing instruction to computing node 2.

[0164] When a user needs to analyze data in a specific column, their client can send a data processing request to the device cluster. Let's assume this request instructs the user to perform an addition operation on the first column of data in rows 1-300. Compute node 3 in the device cluster receives the request, divides the data to be read into multiple groups, generates a multi-machine parallel query plan, and executes the data processing in parallel across multiple compute nodes. For example, suppose a first dataset in the first shared memory space contains data from rows 1-100, a second dataset in the first shared memory space contains data from rows 101-200, and a third dataset in the first shared memory space contains data from rows 201-300. Compute node 3 can divide the data to be read into multiple groups using a shared memory scanning operator. For example, the data in the first column of rows 1-300 to be read can be divided into three groups: the first group is the data in the first column of rows 1-100, the second group is the data in the first column of rows 101-200, and the third group is the data in the first column of rows 201-300. Each group of data corresponds to a specific virtual address. Compute node 3 generates multiple data processing instructions and sends them to different compute nodes. Each data processing instruction carries the address range of the data to be read, and the data can be processed jointly by compute nodes 2, 3, and 1. For example, compute node 2 can perform addition operations on the first column of rows 1-100 in the first dataset, compute node 3 can perform addition operations on the first column of rows 101-200 in the second dataset, and compute node 2 can perform addition operations on the first column of rows 201-300 in the third dataset.

[0165] Computing node 3 sends data processing instructions to both computing node 2 and computing node 1. Simultaneously, computing node 3 reads the first column of rows 101-200 from the second dataset from shared memory and performs an addition operation on the first column of data in rows 101-200. Computing nodes 2 and 1 can execute the same steps after receiving the data processing instructions; this embodiment uses computing node 2 as an example for explanation.

[0166] S1002, Compute node 2 broadcasts a read lock notification.

[0167] Computing node 2 receives a data processing instruction from computing node 3 and, in response, broadcasts a read lock notification to multiple computing nodes in the device cluster. The data processing instruction instructs computing node 2 to perform an addition operation on the first column of data in rows 1 to 100. Upon receiving the data processing instruction, computing node 2 generates a corresponding data read instruction based on it and reads the first column of data in rows 1 to 100. In some embodiments, computing node 2 can read data belonging to the first column of data in rows 1 to 100 from a first dataset in a first shared memory space. In other embodiments, computing node 2 first reads the data belonging to the first column of data in rows 1 to 100 stored in its local memory, and then reads the data belonging to the first column of data in rows 1 to 100 from the first dataset in the first shared memory space. The first column of data in rows 1 to 100 stored in the first dataset is referred to as the fourth data. Before reading the fourth data in the first dataset based on the data read instruction, compute node 2 can broadcast a read lock notification to multiple compute nodes in the device cluster. The read lock notification indicates that the distributed lock of the first dataset is in a read lock state. The read lock state is used to instruct compute nodes that receive the read lock notification to prohibit the column cache data in the first dataset from being marked as invalid data. The following explanation uses compute node 1 as an example.

[0168] S1003, compute node 1 stops executing the operation of marking column cache data in the first dataset as invalid data based on the received read lock notification.

[0169] Step S1003 above is an optional step. When compute node 1 receives the read lock notification broadcast by compute node 2, if there is data in the first dataset that needs to be updated, it will not perform the operation of marking the column cache data in the first dataset as invalid data, but will wait to receive the unlock notification before performing the operation of marking the column cache data in the first dataset as invalid data.

[0170] S1004, compute node 2 reads the fourth data from the first dataset.

[0171] Compute node 2 can scan the first shared memory space using a shared memory scan operator based on the virtual address in the received data read instruction and the row group information of the first dataset stored in the memory of compute node 2, and read the fourth data from the first dataset.

[0172] S1005, Compute node 2 broadcasts an unlock notification.

[0173] After reading the fourth data based on the data read instruction, compute node 2 can broadcast an unlock notification to multiple compute nodes in the device cluster. The unlock notification indicates that the distributed lock of the first dataset is in an unlocked state, and the operation of marking the column cache data in the first dataset as invalid data can be performed.

[0174] S1006, compute node 1, based on the update log, performs an operation to mark the column cache data in the first dataset as invalid data.

[0175] Step S1006 above is an optional step. If there is an update log in compute node 1 involving column cache data in the first dataset, compute node 1 can continue to perform the operation of marking the column cache data in the first dataset as invalid data based on the update log.

[0176] S1007, Computing node 2 performs specified operations on the read data based on data processing instructions to obtain the operation results.

[0177] After reading the fourth data in the first dataset, computing node 2 performs a specified operation on the read data based on the data processing instructions to obtain the operation result. In this embodiment, computing node 2 performs an addition operation on the first column of data in rows 1 to 100 to obtain the addition operation result.

[0178] In some embodiments, step S1007 may be performed before step S1005. The execution order between the steps is not limited in the embodiments of this application.

[0179] S1008, Computing node 2 sends the computation result to computing node 3.

[0180] Computing node 2 will perform an addition operation on the first column of data in rows 1 to 100, and send the result to computing node 3.

[0181] S1009, Computing node 3 obtains the target analysis result based on the received calculation result.

[0182] Suppose the data processing request instructs that an addition operation be performed on the first column of data in rows 1-300. Computing node 3 receives the first result from computing node 2, indicating that the addition operation was performed on the first column of data in rows 1-100. Computing node 1 receives the data processing instruction from computing node 3 and, following the steps of computing node 2, performs an addition operation on the first column of data in rows 201-300, obtaining a second result, which is then sent to computing node 3. Computing node 3 receives the second result from computing node 1, indicating that the addition operation was performed on the first column of data in rows 201-300. Computing node 3 reads the first column of data in rows 101-200 from the first shared memory space, performs an addition operation on the first column of data in rows 101-200, obtaining a third result. Computing node 3 summarizes the three results to obtain the target analysis result and sends the target analysis result to the user's client.

[0183] When other compute nodes in the device cluster access column cache data stored in shared memory, they can follow the same procedure as compute node 2 in reading the second data. For example, when compute node 1 in the device cluster receives a data read command, it can refer to... Figure 9 The process of compute node 2 reading and sending data is shown in the diagram; when compute node 1 in the device cluster receives the data processing instruction, it can refer to... Figure 10 The process shown is as follows: Computation node 2 reads data and performs specified operations on the read data.

[0184] In some embodiments, if the requesting node for performing the data processing task is compute node 1, then compute node 1 can perform... Figure 9 and Figure 10 The steps performed by computing node 3 in the illustrated embodiment will not be repeated here.

[0185] Based on the same design concept as the above embodiments, this application also provides a data storage device, which can be applied to a first computing node in a device cluster. The first computing node can be any computing node in the device cluster. In some embodiments, such as Figure 11 As shown, the data storage device 1100 may include a row-column conversion module 1101 and a data storage module 1102. The data storage device 1100 can be used to implement... Figure 2 The method embodiments shown can achieve the beneficial effects of the above-described method embodiments by providing the functionality of the methods described above.

[0186] The row-to-column conversion module 1101 can be used to obtain row cache data stored in row format and convert the row cache data into column cache data stored in column format; the data storage module 1102 can be used to save the column cache data to a shared memory space, wherein the shared memory space is a memory space that allows multiple computing nodes in the device cluster to access it through memory semantics.

[0187] In some embodiments, such as Figure 12 As shown, the data storage device 1100 may further include a data update module 1201. The data update module 1201 can be used to mark the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data when the first data in the row cache data is updated.

[0188] It should be noted that, in some embodiments, the row-column conversion module 1101 can be used to execute any step in the data storage method, the data storage module 1102 can also be used to execute any step in the data storage method, and the data update module 1201 can also be used to execute any step in the data storage method. The steps implemented by the row-column conversion module 1101, the data storage module 1102, and the data update module 1201 can be specified as needed. The row-column conversion module 1101, the data storage module 1102, and the data update module 1201 respectively implement different steps in the data storage method to achieve all the functions of the service operation device. The data storage device 1100 can also use more or fewer functional modules to achieve the functions of the data storage device.

[0189] In the embodiments of this application, the functional modules can be integrated into a single processor, or each module can exist physically separately, or two or more modules can be integrated into a single module. The integrated modules can be implemented in hardware or as software functional modules.

[0190] This application also provides a computing node, which can be any computing node in a device cluster. The structure of the computing node can be as follows: Figure 1 The computing node 1 is shown in the diagram. The processor of this computing node can be used to execute computer programs to implement the data storage method provided in the embodiments of this application.

[0191] This application also provides a device cluster. The device cluster includes multiple computing nodes. The structure of the computing cluster can be as follows: Figure 1 As shown, multiple computing nodes in the device cluster can be used to implement the functions of the data storage device in the above embodiments. Each computing node in the device cluster may include a processor and memory.

[0192] In some possible implementations, the memories of multiple computing nodes in a device cluster may each contain the same instructions for executing data storage methods.

[0193] In other possible implementations, the memories of multiple computing nodes in the device cluster may each store a portion of the instructions for executing the data storage method. In other words, a combination of multiple computing nodes can jointly execute the instructions for executing the data storage method.

[0194] This application also provides a chip that can be applied to any computing node. This chip can be used to implement the functions of the above-described method embodiments, and therefore can achieve the beneficial effects of the above-described method embodiments.

[0195] In some embodiments, the structure of the chip 1300 can be as follows: Figure 13 As shown, the system includes a processor 1301 and a power supply circuit 1302 connected to the processor 1301. The processor 1301 and the power supply circuit 1302 can be interconnected via a bus. The processor 1301 can be a digital signal processor (DSP), ASIC, field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or other specific integrated circuits. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be categorized as an address bus, data bus, control bus, etc. The power supply circuit 1302 supplies power to the processor 1301 via the bus.

[0196] The processor 1301 can be connected to a memory located outside the chip or to a memory located inside the chip, and run software programs and modules stored in the memory to perform various functional applications and data processing of the chip 1300, such as the data storage method provided in the embodiments of this application, so as to improve data analysis efficiency.

[0197] In some embodiments, the processor 1301 may include one or more processing units, which may be independent devices or integrated into one or more processors. The processor 1301 may also include a controller, which can generate operation control signals according to the instruction opcode and timing signals to control the instruction fetching and execution.

[0198] The method steps in the embodiments of this application can be implemented in hardware or by a processor executing a computer program or instructions. The computer program or instructions can constitute a computer program product.

[0199] This application also provides a computer program product comprising computer-executable instructions. In one embodiment, the computer-executable instructions are used to cause a computer to perform the functions described in the method embodiments above.

[0200] Computer-executable instructions can be stored in a computer-readable storage medium. This application also provides a computer-readable storage medium storing executable instructions. In one embodiment, the computer-executable instructions are used to cause a computer to perform the functions described in the method embodiments above.

[0201] The computer-readable storage medium provided in the embodiments of this application may be random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), register, hard disk, portable hard disk, CD-ROM, or any other form of computer-readable storage medium known in the art.

[0202] Computer-executable instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive.

[0203] One or more of the above modules or units can be implemented by software, hardware, or a combination of both. When any of the above modules or units is implemented by software, the software exists as computer program instructions and is stored in memory. The processor can be used to execute the program instructions and implement the above method flow. The processor can include, but is not limited to, at least one of the following: CPU, microprocessor, digital signal processor (DSP), microcontroller unit (MCU), or artificial intelligence processor, etc., various computing devices that run software. Each computing device may include one or more cores for executing software instructions to perform calculations or processing. The processor can be built into a SoC, DPU, or ASIC, or it can be a separate semiconductor chip. In addition to the cores for executing software instructions to perform calculations or processing, the processor may further include necessary hardware accelerators, such as FPGAs, PLDs, or logic circuits that implement dedicated logic operations.

[0204] When the above modules or units are implemented in hardware, the hardware can be any one or any combination of CPU, microprocessor, DSP, MCU, artificial intelligence processor, ASIC, SoC, FPGA, PLD, special purpose digital circuit, hardware accelerator or non-integrated discrete device, which can run the necessary software or perform the above method flow independently of software.

[0205] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the scope of the technology disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application.

Claims

1. A data storage method, characterized in that, The method is applied to the first computing node in a device cluster; the method includes: Retrieve row cache data stored in row format; Convert the row cache data into column cache data stored in column format; The column cache data is saved to a shared memory space; the shared memory space is a memory space that can be accessed by multiple computing nodes in the device cluster through memory semantics.

2. The method according to claim 1, characterized in that, Saving the column cache data to the shared memory space includes: The column cache data is saved to the local memory space of the first computing node; When the amount of column cache data stored in the local memory space of the first computing node reaches a set threshold, the column cache data stored in the local memory space of the first computing node is saved to the shared memory space.

3. The method according to claim 1 or 2, characterized in that, Its features are, The method further includes: If the first data in the row cache data is updated, the data corresponding to the first data in the column cache data stored in the shared memory space will be marked as invalid data.

4. The method according to claim 3, characterized in that, The method further includes: Before marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data, a first notification is sent to the remaining computing nodes other than the first computing node among the plurality of computing nodes; the first notification is used to prohibit the remaining computing nodes from reading the column cache data in the shared memory space; After marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data, a second notification is sent to the remaining computing nodes; the second notification is used to allow the remaining computing nodes to read the column cache data in the shared memory space.

5. The method according to claim 4, characterized in that, The multiple computing nodes store a distributed lock for the shared memory space; The first notification is used to prevent the remaining computing nodes from reading column cache data in the shared memory space by indicating that the distributed lock is in a write-locked state; The second notification is used to allow the remaining computing nodes to read column cache data in the shared memory space by indicating that the distributed lock is in an unlocked state.

6. The method according to claim 4 or 5, characterized in that, The attribute information of the data corresponding to the first data is stored in the first computing node; Marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data includes: modifying the attribute information of the data corresponding to the first data to be invalid; The method further includes: A third notification is sent to the plurality of computing nodes; the third notification is used to indicate that the column cache data corresponding to the first data is invalid data.

7. The method according to any one of claims 2 to 6, characterized in that, The method further includes: Based on the first data read instruction, the first data read instruction is executed with the local memory space and the shared memory space of the first computing node as the query scope.

8. The method according to claim 7, characterized in that, The first data read instruction instructs the reading of second data; the step of executing the first data read instruction with the local memory space of the first computing node and the shared memory space as the query range includes: If it is determined that the second data is stored in the local memory space of the first computing node, then the second data is read from the local memory space of the first computing node; or If it is determined that the second data is stored in the shared memory space, then the second data is read from the shared memory space.

9. The method according to claim 8, characterized in that, If it is determined that the second data is stored in the shared memory space, the method further includes: Before reading the second data from the shared memory space, a fourth notification is sent to the remaining computing nodes among the plurality of computing nodes, excluding the first computing node; the fourth notification is used to prohibit the remaining computing nodes from performing the operation of marking the column cache data in the shared memory space as invalid data; After reading the second data from the shared memory space, a fifth notification is sent to the remaining computing nodes; the fifth notification is used to allow the remaining computing nodes to perform the operation of marking the column cache data in the shared memory space as invalid data.

10. The method according to claim 9, characterized in that, The method further includes: the plurality of computing nodes storing a distributed lock for the shared memory space; the fourth notification being used to prevent the remaining computing nodes from performing the operation of marking the column cache data in the shared memory space as invalid data by instructing the distributed lock to be in a read-locked state; and the fifth notification being used to allow the remaining computing nodes to perform the operation of marking the column cache data in the shared memory space as invalid data by instructing the distributed lock to be in an unlocked state.

11. The method according to any one of claims 1 to 10, characterized in that, The method further includes: A second data read instruction is sent to at least two of the plurality of computing nodes; the second data read instruction is used to instruct the at least two computing nodes to read data from the shared memory space in parallel. Receive data returned by the at least two computing nodes; the data is read by the at least two computing nodes from the shared memory space.

12. A data storage device, characterized in that, The device is applied to the first computing node in a device cluster; the device includes: The row-to-column conversion module is used to obtain row cache data stored in row format and convert the row cache data into column cache data stored in column format. The data storage module is used to save the column cache data to a shared memory space; the shared memory space is a memory space that can be accessed by multiple computing nodes in the device cluster through memory semantics.

13. The apparatus according to claim 12, characterized in that, The data storage module is specifically used for: The column cache data is saved to the local memory space of the first computing node. When the amount of column cache data stored in the local memory space of the first computing node reaches a set threshold, the column cache data stored in the local memory space of the first computing node is saved to the shared memory space.

14. The apparatus according to claim 12 or 13, characterized in that, The device also includes a data update module; The data update module is used to mark the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data when the first data in the row cache data is updated.

15. The apparatus according to claim 14, characterized in that, The data update module is also used for: Before marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data, a first notification is sent to the remaining computing nodes other than the first computing node among the plurality of computing nodes; the first notification is used to prohibit the remaining computing nodes from reading the column cache data in the shared memory space; After marking the data corresponding to the first data in the column cache data stored in the shared memory space as invalid data, a second notification is sent to the remaining computing nodes; the second notification is used to allow the remaining computing nodes to read the column cache data in the shared memory space.

16. A computing node, characterized in that, It includes at least one processor and at least one memory; wherein the at least one memory stores one or more computer programs, the one or more computer programs including instructions that, when executed by the at least one processor, cause the computing node to perform the method as described in any one of claims 1 to 11.

17. A chip, characterized in that, It includes a processor and a power supply circuit; the power supply circuit is used to supply power to the processor, and the processor is used to execute a computer program to implement the method as described in any one of claims 1 to 11.

18. A cluster of devices, characterized in that, It includes multiple computing nodes, each of which includes a processor and memory; The processors of the plurality of computing nodes are used to execute instructions stored in the memory of the plurality of computing nodes, so that the device cluster performs the method as described in any one of claims 1 to 11.

19. A computer program product, characterized in that, It includes computer-executable instructions for causing a computer to perform the method as described in any one of claims 1 to 11.