A data caching method, system and apparatus
By implementing local data caching in the data caching service process and client within the computing device container, and adopting columnar data format and partitioned indexes, the problem of high data read overhead between the computing layer and storage layer of OLAP database is solved, thereby improving the working efficiency of computing nodes and data query speed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2023-02-01
- Publication Date
- 2026-04-21
AI Technical Summary
In a compute-storage separation architecture, the compute layer of an OLAP database needs to frequently read data from the storage layer across devices, resulting in significant data read overhead and impacting work efficiency.
The data caching service process is started within the container of the computing device. Data requests are cached locally through the data caching client and service processes, reducing direct access to the storage layer. Columnar data format and partitioned index are used to optimize data querying, and Apache Arrow format is used for data storage and transformation.
It effectively reduces the frequency of repeated data calls, improves the working efficiency of computing nodes, reduces network overhead, optimizes the data query and loading process, and ensures the independence and efficiency of the computing process.
Smart Images

Figure CN115964001B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a data caching method, system, and apparatus. Background Technology
[0002] OLAP (Online Analytical Processing) analytical databases are evolving towards a compute-storage separation architecture. This architecture uses different computing devices for data computation and storage, respectively. The advantage of this architecture is that both the compute layer (containing several computing devices, or compute nodes, for data computation) and the storage layer (containing several computing devices, or storage nodes, for data storage) can be scaled up or down as needed: more compute nodes are added when the computational load increases; more storage nodes are added when the amount of data written increases.
[0003] However, the main problem exposed by separating compute and storage is that the compute layer needs to read data from the storage layer across devices when performing computational tasks. OLAP computational tasks often require scanning or reading large amounts of data for statistical analysis, resulting in significant data read overhead. How to reduce data read overhead and improve the efficiency of OLAP databases is a pressing technical problem that needs to be solved. Summary of the Invention
[0004] One embodiment of this specification provides a data caching method, executed on a computing device, comprising: starting a data caching service process within a container; determining a data request from a computing process in the container via a data caching client and transmitting the data request to the data caching service process; obtaining metadata of the data corresponding to the data request via the data caching service process and feeding it back to the data caching client; and obtaining the data corresponding to the data request via the data caching client based on the metadata and submitting it to the computing process for use.
[0005] One embodiment of this specification provides a data caching system for deployment in a computing device, comprising: a data caching service module for starting within a container in the computing device, thereby becoming a data caching service process; a data caching client for obtaining a data request from a computing process when invoked by the computing process in the container, and transmitting the data request to the data caching service process; the data caching service process for obtaining metadata of the data corresponding to the data request and feeding it back to the data caching client; and the data caching client for obtaining the data corresponding to the data request based on the metadata and submitting it to the computing process for use.
[0006] One embodiment of this specification provides an apparatus including a processor and a storage medium, the storage medium storing computer instructions, and the processor executing the computer instructions to implement the data caching method. Attached Figure Description
[0007] This specification will be further described by way of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting; in these embodiments, the same reference numerals denote the same structures, wherein:
[0008] Figure 1 This is a schematic diagram illustrating the application scenario of a database with a compute-storage separation architecture according to some embodiments of this specification;
[0009] Figure 2 This is a schematic diagram of data caching within a computing device container according to some embodiments of this specification;
[0010] Figure 3 This is a schematic diagram illustrating the acquisition of target data from a storage area outside the container, according to some embodiments of this specification;
[0011] Figure 4 This is a schematic diagram illustrating the reclamation of at least a portion of the process address space by a data caching service process according to some embodiments of this specification;
[0012] Figure 5 This is a block diagram of a data caching system according to some embodiments of this specification. Detailed Implementation
[0013] To more clearly illustrate the technical solutions of the embodiments in this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely some examples or embodiments of this specification. For those skilled in the art, these drawings can be applied to other similar scenarios without creative effort. Unless obvious from the context or otherwise specified, the same reference numerals in the drawings represent the same structures or operations.
[0014] It should be understood that the terms “system,” “device,” “unit,” and / or “module” used herein are one way to distinguish different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they may be replaced by other expressions.
[0015] As indicated in this specification, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of expressly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.
[0016] Flowcharts are used in this specification to illustrate the operations performed by the system according to embodiments of this specification. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, the steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.
[0017] In addition to data storage and maintenance, analytical databases also emphasize data analysis and computation. Taking OLAP analytical databases as an example, they often involve a large number of dimension table accesses, time-triggered time-sliding window-based indicator calculations (such as calculating product revenue for the current month on a monthly basis), and iterative analysis and computation on the same batch of table data (such as iteratively optimizing the parameters of a certain influencing factor or machine learning model based on the same batch of table data).
[0018] Currently, analytical databases are evolving towards a compute-storage separation architecture, such as the Snowflake analytics engine. This architecture separates the computing devices (or compute nodes) used for data analysis from the computing devices (or storage nodes) used for data storage. Compute nodes read data from storage nodes via the network, and after completing the analysis, the results can be stored on the storage nodes.
[0019] Figure 1 This is a schematic diagram illustrating the application scenario of a database with a compute-storage separation architecture as shown in some embodiments of this specification.
[0020] like Figure 1 As shown, the application scenarios of the database can include the user terminal 110 and the database cluster 120.
[0021] User terminal 110 may be one or more terminal devices or software used by a user. User terminal 110 may include a processing unit, a display unit, an input / output unit, a sensing unit, a storage unit, etc. In some embodiments, user terminal 110 may be one or any combination of devices such as mobile device 110-1, tablet computer 110-2, laptop computer 110-3, desktop computer 110-4, and smartphone 110-n. User terminal 110 can communicate with database cluster 120 through network 130. For example, user terminal 110 may request database cluster 120 to return the sales statistics report of the previous quarter.
[0022] The database cluster 120 may further include a computing layer 121, a storage layer 122, and a network 123 connecting them. The computing layer 121 may include multiple computing nodes (such as computing nodes 121-1, 121-2, and 121-3), which can be implemented using computing devices with higher computing performance, for data computation and analysis. The storage layer 122 may include multiple storage nodes (such as storage nodes 122-1, 122-2, and 122-3), which can be implemented using computing devices with larger storage capacity, for data storage. In the database cluster 120, the computing layer composed of computing nodes can be considered the cluster's computing engine, implementing data computation and analysis functions. In some embodiments, the multiple computing nodes can be constructed as a multi-process, multi-threaded OLAP analysis engine. Different OLAP analysis engine processes can respond to different user requests and perform corresponding data processing operations. The storage layer composed of storage nodes can be considered the cluster's "database," implementing data storage functions. The compute nodes and storage nodes communicate via network 123. The compute nodes can request relevant data from the storage nodes via network 123 for computation and analysis, and record the computation results in the storage nodes via network 123. In some embodiments, the database cluster 120 may further include a central server and / or a load balancer (not shown in the figure). The central server interacts with the user terminal 110, receiving data requests from the user terminal and returning the requested data. The load balancer distributes user requests to different compute nodes for processing according to load balancing principles, ensuring that the compute nodes in the cluster operate in an orderly and efficient manner. In some embodiments, the central server and the load balancer may be combined.
[0023] In some embodiments, the aforementioned computing device may include a processor and a storage medium. By way of example only, the processor may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), an application-specific instruction processor (ASIP), a graphics processing unit (GPU), a physical processor (PPU), a digital signal processor (DSP), a field-programmable gate array (FPGA), a programmable logic device (PLD), a controller, a microcontroller unit, a reduced instruction set computer (RISC), a microprocessor, or any combination thereof. The storage medium may be used to store data and / or instructions. For example, it may store user-written program code, data tables, knowledge graphs, etc. In some embodiments, the storage device may include random access memory (RAM), read-only memory (ROM), mass storage, removable memory, volatile read-write memory, or any combination thereof. Exemplarily, mass storage may include a hard disk, an optical disk, a solid-state drive, etc.
[0024] Networks (such as network 130 and network 123) can connect various components in the scenario. Networks enable communication between these components, facilitating the exchange of data and / or information. In some embodiments, the network can be any one or more of wired or wireless networks. For example, the network can include a cable network, fiber optic network, telecommunications network, Internet, local area network (LAN), wide area network (WAN), wireless local area network (WLAN), metropolitan area network (MAN), public switched telephone network (PSTN), Bluetooth network, ZigBee network, near field communication (NFC), device bus, device wiring, cable connection, etc., or any combination thereof. Network connections between components can be achieved using one or more of the above methods. In some embodiments, the network can be a point-to-point, shared, centralized, or other topologies, or a combination of multiple topologies. In some embodiments, the network can include one or more network access points. For example, network 130 can include wired or wireless network access points through which user terminals 110 can connect to network 130 to exchange data and / or information.
[0025] Database clusters often require handling large amounts of data reading and computation, necessitating frequent access to storage nodes by compute nodes. This data interaction often involves the repeated reading of specific data, known as "hot data." To effectively reduce internal cluster data communication overhead, some embodiments of this specification provide a data caching method that effectively reduces the frequency of repeated access to hot data, thereby improving cluster operating efficiency. In some embodiments, the data caching method can be executed by compute nodes (such as compute node 121-1).
[0026] Figure 2This is a schematic diagram of a data cache within a computing device container, as illustrated in some embodiments of this specification.
[0027] A container is a virtual concept in computing devices. Computing devices contain computing resources such as processors and memory. When a program runs (or is called a process, i.e., a running computer program) on a computing device, it consumes certain computing resources. A container can be used by one or more processes, and sometimes it can be considered as containing one or more of these processes. In some embodiments, the functions of multiple processes within a container can be the same or similar, such as all performing data computation. The functions of multiple processes can also cooperate, such as including processes for data computation and processes for data storage (e.g., processes on a computing node that store computation results on the local disk). Within a computing node, a container can contain one or more computing processes to perform data analysis and computation. The data computation referred to here can be broad, including data querying, as well as various operations such as addition, subtraction, multiplication, and division on data.
[0028] like Figure 2 As shown in some embodiments of this specification, the data caching method can establish a data caching service process (also referred to as a data caching service, Table Cache Service) in the container of a computing device. Through this service process, the data required by the computing process in the container can be cached in the container. The computing process only needs to directly read the cached data (memory-level response speed) without having to frequently request data from the storage node through the network, thereby reducing network overhead and effectively improving the working efficiency of the computing node.
[0029] In some embodiments, the data caching service process can originate from a data caching service module. The data caching service module can be computer code or a package that implements data caching service functions; when it runs, it forms the data caching service process. To enable inter-process communication, a data caching client corresponding to the data caching service also needs to be configured. The data caching client is computer code or a package used to communicate with the data caching service, implement data mapping, data reading, and other functions. The data caching client can be called by other programs or processes (such as computing processes in a container) to implement the above functions. It can also be understood that the data caching service is implemented by an independent process, while the data caching client mainly exists within other processes. In some embodiments, the data caching client can determine the data request of its own computing process and transmit the data request to the data caching service process. The data caching service process can obtain metadata about the data corresponding to the data request and feed it back to the data caching client. The metadata can indicate where the data is stored, specifically a logical address or location identifier. The data caching client can obtain the data corresponding to the data request based on the metadata and submit it to the computing process for use.
[0030] In some embodiments, the data caching service process can map a piece of data into its process address space as a cached data file. Simultaneously, the data caching client maps this data into the process address space of its own computing process.
[0031] Processes can use the computing resources of computing devices, including storage space. Generally, a process can address a certain size of physical space (e.g., 2GB, 4GB). This addressable space can reside in memory or on disk. However, what a process perceives is a segment of address space from its start address (e.g., 0x0000) to its end address (e.g., 0xFFFF). This segment of address space is also called the process address space. The process address space is also a virtual concept, and it corresponds one-to-one with a process. The physical spaces corresponding to the process address spaces of different processes may be different. This means that for the same address 0xC000, the data read by process 1 from its process address space may be different from the data read by process 2 from its process address space. Of course, the physical spaces corresponding to the process address spaces of different processes can also overlap. But regardless of the relationship of the physical spaces, the process address spaces of different processes are logically relatively independent. A process can map data, such as in the form of files or other objects (e.g., using mmap), to its process address space. Afterward, the process can read and write this data using pointers (or addresses).
[0032] In some embodiments, the same cached data file is mapped to the process address spaces of the data caching service process and the computing process respectively, which actually realizes the sharing of the physical space for storing the cached data file. The two processes can address the data in the cached data file through their own process address spaces.
[0033] In some embodiments, the computing process can request required data through query statements or read instructions, which may include instruction keywords and data identifiers. Instruction keywords may include "select," "get," etc., and data identifiers indicate the requested data, such as one or more of the following: filename, primary key value (e.g., ID number), partition name (or partition identifier), and column name (column identifier). For ease of description, the requested data may also be simply referred to as target data. Target data may be records in one or more partitions, or further, the content of certain columns in one or more partitions; this specification does not limit this. In some embodiments, when the data caching client receives relevant instructions or statements from the computing process, it can determine the computing process's data request. For example, the data caching client can determine the requested data from the relevant instructions or statements. In some embodiments, the data request of the computing process can be described using one or more combinations of filename, column name, and partition name. Furthermore, the data caching client can communicate with the data caching service process and send the data request to the data caching service process.
[0034] In some embodiments, the data caching client and the data caching service can communicate via pipes, message queues, and sockets. For example, the data caching client writes a data request to a pipe, and the data caching service process can read the data request from the pipe. Alternatively, the data caching client can write a data request to a message queue in kernel space, and the data caching service process can read the data request from the message queue. In some embodiments, the data caching client and the data caching service process can also establish socket communication (based on the TCP / IP protocol) to exchange data.
[0035] After receiving a data request from the computing process, the data caching service process can query the corresponding target data in its process address space. If the target data is found, its storage offset and storage length in its process address space are determined and used as the target data's metadata. The storage offset refers to the increment of the target data's storage address relative to the starting address of the cached data file. The storage length is the size of the storage space occupied by the target data. For example, if the starting address of the cached data file is 0x0100 in the process address space, the target data's storage address is 0x0200, and the target data is stored from 0x0200 to 0x0400, then the target data's storage offset in the process address space can be determined to be (0x0200 - 0x0100), and its storage length to be (0x0400 - 0x0200) = 200 bytes. The data caching service process communicates with the data caching client, returning the target data's metadata to the client. Communication methods can include, but are not limited to, the aforementioned pipes, message queues, and socket communication.
[0036] Although different processes have different process address spaces, the storage offset and storage length are relative positional information. Therefore, as long as another process (such as a computing process) contains the same cached data file in its process address space, the process can still accurately locate the target data based on the file's storage address (starting address) in its process address space and the relative position information of the target data. In some embodiments, after the data caching client obtains the metadata of the target data, it can locate the storage address and storage range of the target data in the space based on the storage address of the cached data file in the computing process's process address space. Furthermore, the data caching client can then pass the target data to the computing process for use. Further descriptions of the data caching client passing the target data to the computing process for use can be found in... Figure 3 The relevant instructions can be found there.
[0037] In real-world applications, the data caching service process cannot map all the data needed by the computing process into the kernel space. Therefore, situations may arise where the data requested by the computing process does not exist in the process's address space. In this case, the data caching service process retrieves the target data from external storage devices and maps it into the process's address space. Simultaneously, the data caching client also maps the target data into the computing process's address space. Afterward, the data caching service process and the client can follow the aforementioned process to retrieve the target data and deliver it to the computing process.
[0038] Figure 3 This is a schematic diagram illustrating the acquisition of target data from a storage area outside the container, according to some embodiments of this specification.
[0039] In some embodiments, data can be stored in the form of a data table. A data table, also known as a two-dimensional table, includes columns and rows. Rows correspond to records or instances, and columns correspond to fields. Taking a student table as an example, its rows include records of students such as Xiaoming and Xiaohong, and its columns may include fields such as ID number (or student ID), name, gender, grade, and class.
[0040] Before performing calculations, users can request the creation of a cache table. A cache table means that data is not copied repeatedly, essentially creating a view based on various data sources. Users can further specify the records, fields, and data sources included in the cache table. In some embodiments, the data in a cache table can come from different data sources or the original data tables. As an example, a user can request the creation of a cache table named "2022 Annual Sales Records," which includes sales data for three categories of goods: stationery, clothing, and cleaning supplies for the year. The stationery data comes from Table 1, the clothing data from Table 2, and the cleaning supplies data from Table 3. Table 1 is located on storage node 122-1, and Tables 2 and 3 are located on storage node 122-2. The columns or fields of the cache table include product number, name, transaction time, and amount. In some embodiments, users can request the creation of a cache table from a compute node or central server in the database cluster. The data caching service module can provide a DDL (Data Definition Language) interface to users through a client, allowing users to create cache tables using the CREAT TABLE command. Taking a central server as an example, it can create a cache table in response to a user's creation request and record the data source or storage address of each record and / or column in the cache table. In some embodiments, the central server can also create a partitioned index for the cache table. As an example, the transaction time of the cache table "2022 Annual Sales Records" can be used as the partition key to create four partitions for the first quarter, second quarter, third quarter, and fourth quarter. In some embodiments, the partition key can also be specified by the user, for example, by declaring PARTITION BY + column name. The partitioned index records the storage address or data source corresponding to different partitions, and can accelerate table partition lookups. The partitioned index can be constructed based on the partition key definition and the full data in the cache table, or it can be directly obtained from external storage (such as when the external storage has already partitioned the data and created a partitioned index). In some embodiments, the cache table and its partitioned index can be cluster-wide, meaning that any modifications made to the cache table by the central server can be synchronized in a timely manner by the cluster's computing nodes.
[0041] In some embodiments, data tables can be stored in a columnar data format. Columnar data format stores the data in the columns of the data table contiguously. Taking Table 1 as an example, assuming there are 100 sales records for stationery in the table, columnar data format would store the product IDs of the 100 records contiguously, the product names of the 100 records contiguously, and so on, until the transaction amounts of the 100 records are stored contiguously. Columnar data format is more suitable for statistical analysis, such as finding the maximum value and calculating the average. It also effectively utilizes the high-performance vectorized computing capabilities of next-generation computing devices. Therefore, using columnar data format to store data can further improve the efficiency of the database cluster. In some embodiments, the data table can be partitioned, and the columns of different partitions can be stored contiguously. For example, the product IDs of the 30 records in the first quarter partition of Table 1 can be stored contiguously, the product names of the 30 records in the partition can be stored contiguously, and so on, until the transaction amounts of the 30 records in the partition are stored contiguously. The contents of each column of the 25 records in the second quarter partition of Table 1 can be stored contiguously, and so on.
[0042] In some embodiments, the data can be further stored in Apache Arrow format. Apache Arrow format is a general-purpose columnar data format accepted or compatible with various database products. Apache Arrow format uses data blocks as storage units, with each data block containing all columns or fields of a limited number (e.g., 8192) of rows or records. Each data block is a contiguous address space and consists of a block header and all column values. A data table can be stored as multiple data blocks. Figure 3 The cached data file in the image shows the structure of data block 1, which includes a block header and n column values. The block header contains index information for each column, and the column values contain the values (or field contents) of all rows in the database for that column. Taking the first quarter partition of Table 1 as an example, one or more data blocks can be used to store the records of that partition. The block header contains the starting positions of the four columns "Product Number", "Name", "Transaction Time", and "Amount" in the column value area. The data block includes 30 consecutively stored column values for the "Product Number" column, 30 column values for the "Name" column, 30 column values for the "Transaction Time" column, and 30 column values for the "Amount" column.
[0043] Using the Apache Arrow format to store data ensures compatibility with data formats from different data sources, supports efficient conversion of different storage systems into local columnar cache data, and provides diverse data source integration in OLAP scenarios.
[0044] When a compute node or the entire database cluster uses a columnar data format, the partition index of the cache table can record the data blocks corresponding to different partitions (e.g., partition 1 corresponds to data blocks 1-4, data in partition 2 is stored in data blocks 5-8, and data in partition 3 is stored in data blocks 9-m), as well as the storage location of each data block. Data can be mapped to the process address space as needed, in units of data blocks. When the data caching service process does not query the corresponding target data in its process address space, it can determine the partition where the target data requested by the compute process is located, and the storage address of that partition, based on the partition index of the cache table. In some embodiments, although the target data is not in the process address space, it still exists on the disk of the local compute node. In this case, the data caching service process can directly map the target data or one or more partitions containing the target data into its process address space in the form of another cache data file. At the same time, the data caching service process can notify the data caching client to map the cache data file into the process address space of the compute process. In some embodiments, the data caching service process can also record the starting address of the cache data file in its process address space and the storage address corresponding to each column. Similarly, the data caching client can also record the starting address of the cached data file in the process address space of the computing process, as well as the storage address corresponding to each column.
[0045] In some embodiments, the target data or its partition does not exist on the local compute node. For example, a partition index indicates that the corresponding partition is located on storage node 122-3 or even on a compute device outside the cluster (referred to as external storage). In this case, the data caching service process needs to access the corresponding external storage via the network to request the partition where the target data is located. As an example, the data caching service process can initiate a data query request to the corresponding external storage based on Socket communication. Furthermore, the data caching service process can load the missing partition from external storage to the local compute node using a data loader. The data loader can be code or a computer program used to implement data loading, and it can be further divided into two parts: a table structure mapping and an external storage wrapper. The table structure mapping records the conversion relationship between different data storage structures and local columnar data formats. The external storage wrapper can generate a data query request suitable for external storage based on the data request, and receive the data returned by the external storage, converting the data returned by the external storage into a local columnar data format, such as Apache Arrow format, based on the table structure mapping. In some embodiments, the external storage also uses the same columnar data format to store data. In this case, the step of format conversion of the data returned by the external compute device based on the table structure mapping can be omitted. When the target data or its partition is loaded onto this compute node, such as when it is stored on the local disk, the data caching service process and the data caching client can map it to their respective process address spaces.
[0046] When local data is stored in columnar data format, the data caching client, upon obtaining the target data in columnar data format from the process address space of the computing process, can further convert the target data from columnar data storage format to row-based data. Row-based data refers to organizing data by rows. The data caching client can read the relevant columns of the target data using a columnar reader (a code component or computer program used to read data columns). The columnar reader can be further encapsulated into a row iterator (a code component or computer program used to convert the target data from columnar data storage format to row-based data). The row iterator can read the column value of each row of data from the corresponding position based on the columnar data format. For example, it can read the name, transaction time, and amount of product number 001 from columns 2 to 4, and then output the data row for product 001. Similarly, the row iterator can sequentially output the data rows for product 002, product 003, and so on. Apache Arrow not only provides a general columnar data format but also provides reading clients for different programming languages, allowing data within column values to be read according to the corresponding data type. In some embodiments, after determining the storage location of the target data in the process address space of the computing process, the data caching client can invoke Apache Arrow to retrieve the data corresponding to the data request based on the storage location and submit it to the computing process. The OLAP analysis engine can provide a columnar scanner, which can read data column by column and use it for vectorized computation, greatly improving data processing speed. Therefore, in some other embodiments, the data caching client can also pass the metadata of the target data to the columnar scanner in the computing process. The columnar scanner can directly retrieve the data in the columnar data storage format corresponding to the data request based on the starting address of the cached data file and the metadata, and perform vectorized computation.
[0047] In some embodiments, the data caching service process can allocate corresponding space in the process address space for the data to be mapped using a storage allocator (code or computer program used for storage allocation). For example, the storage allocator can allocate addresses 0x1000 to 0x1200 in the process address space to the new target data or its partition. However, the process address space is finite. When the storage allocator cannot allocate new space in the process address space to store the missing data returned by the data loader, the data caching service process can evict some local data based on a certain eviction mechanism to free up space for the newly loaded data. In some embodiments, an LRU eviction mechanism can be used to determine the space that can be reclaimed. LRU, short for Least Recently Used, aims to select the least recently used data for eviction.
[0048] Figure 4This is a schematic diagram illustrating how a data caching service process reclaims at least a portion of its process address space according to some embodiments of this specification.
[0049] To prevent space reclamation from disrupting the data reading behavior of parallel computing processes, the data caching service process can obtain data currently being accessed by computing processes from the process address space (or cache data file) from the data caching client. When the data corresponding to the space to be reclaimed is no longer being accessed by computing processes, the space is then reclaimed. When data is stored in a columnar data structure, the data caching service process can set a counter for each column in the cache data file (e.g., ...). Figure 4 The counters shown (e.g., column 1 counter, column 2 counter, etc.) can be initially set to 0. When a computation process accesses a column, the data caching client sends a notification to the data caching service process, which then increments the counter for the corresponding column by 1. When the computation process exits the access, the client notifies the data caching service process again, which decrements the counter for the corresponding column by 1. By maintaining these counters, it's easy to know whether a column is being read in parallel by a client (or computation process). Only when the counter value of a column stored in the reclaimed space is 0 will the address space corresponding to that column be truly reclaimed by the storage allocator for allocation to new data.
[0050] Through data loading and space reclamation, containers can adaptively or dynamically cache frequently accessed hot data by computing processes. Data with higher access frequency is cached longer within the container, improving the utilization efficiency of the container kernel space. It should be noted that most embodiments in this specification are illustrated using a single computing process as an example. However, in practical applications, the data caching service process can provide caching services to multiple computing processes simultaneously. This includes different computing processes using different data cache files, or different computing processes using the same data cache file. Regardless of the scenario, the interaction between the service process and the client follows the technical principles embodied in the foregoing embodiments and falls within the scope of this specification.
[0051] Figure 5 This is a block diagram of a data caching system according to some embodiments of this specification.
[0052] like Figure 5 As shown, the data caching system 500 may include a data caching service module 510 and a data caching client 520. In some embodiments, the data caching system 500 may be deployed in a computing node.
[0053] The data caching service module 510 can be started within a container in a computing device, thus becoming a data caching service process.
[0054] The data caching client 520 can be used to obtain the data request of the computing process when it is called by the computing process in the container, and transmit the data request to the data caching service process.
[0055] The data caching service process is used to obtain metadata about the data corresponding to the data request and feed it back to the data caching client. The data caching client is also used to determine the data corresponding to the data request based on the metadata and submit it to the computing process for use.
[0056] For more information on the data caching service module and client, please refer to [link / reference]. Figures 2-4 The relevant explanations will not be repeated here. It should be understood that... Figure 5 The systems and modules shown can be implemented in various ways. For example, in some embodiments, the systems and modules can be implemented by hardware, software, or a combination of both. The hardware portion can be implemented using dedicated logic; the software portion can be stored in memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated-design hardware. Those skilled in the art will understand that the methods and systems described above can be implemented using computer-executable instructions and / or included in processor control code, for example, on a carrier medium such as a disk, CD, or DVD-ROM, a programmable memory such as read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The systems and modules of this specification can be implemented not only by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field-programmable gate arrays, programmable logic devices, etc., but also by software, for example, executed by various types of processors, or by a combination of the aforementioned hardware circuits and software (e.g., firmware).
[0057] It should be noted that the above description of the system and its modules is for convenience only and should not be construed as limiting this specification to the embodiments described. It is understood that those skilled in the art, after understanding the system's principles, may arbitrarily combine the modules or construct subsystems connected to other modules without departing from these principles. For example, in some embodiments, the data caching service module 510 can be further subdivided into multiple sub-modules, such as a storage allocator and a data loader. The data caching client 520 can also be further subdivided into row iterators, etc. Such modifications are all within the scope of this specification.
[0058] The beneficial effects that the embodiments of this specification may bring include, but are not limited to: (1) The main information exchanged between the computing process and the data caching service is the metadata of the target data, which is very small relative to the amount of target data that actually needs to be read; the data caching service process and the client achieve zero-copy high-performance exchange of target data through shared memory; (2) The cache table introduces partitioning and in-memory columnar data structure, which optimizes the cache data query, eviction and loading process; (3) The independent data caching service process ensures isolation. For example, the upgrade or abnormality of the local data caching service process will not affect other computing processes in the same container, and the upgrade / restart of the computing process application will not trigger the restart of the data caching service process; (4) The local data caching service can simultaneously serve the access needs of multiple computing processes in the local container for cached data and realize data sharing. It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced can be any one or a combination of the above, or any other possible beneficial effects.
[0059] The basic concepts have been described above. Obviously, for those skilled in the art, the detailed disclosure above is merely illustrative and does not constitute a limitation on the embodiments of this specification. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements, and corrections to the embodiments of this specification. Such modifications, improvements, and corrections are suggested in the embodiments of this specification, and therefore, such modifications, improvements, and corrections still fall within the spirit and scope of the exemplary embodiments of this specification.
[0060] Furthermore, this specification uses specific terms to describe embodiments thereof. For example, "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic associated with at least one embodiment of this specification. Therefore, it should be emphasized and noted that references to "an embodiment," "one embodiment," or "an alternative embodiment" in different locations throughout this specification do not necessarily refer to the same embodiment. Moreover, certain features, structures, or characteristics in one or more embodiments of this specification can be appropriately combined.
[0061] Furthermore, those skilled in the art will understand that various aspects of the embodiments of this specification can be described and illustrated through several patentable types or situations, including any new and useful combinations of processes, machines, products, or substances, or any new and useful improvements thereto. Accordingly, various aspects of the embodiments of this specification can be implemented entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. All of the above hardware or software may be referred to as a "data block," "module," "engine," "unit," "component," or "system." Furthermore, various aspects of the embodiments of this specification may be embodied as a computer product located on one or more computer-readable media, the product including computer-readable program code.
[0062] Computer storage media may contain a propagated data signal containing computer program code, for example, on baseband or as part of a carrier wave. This propagated signal may take various forms, including electromagnetic, optical, and suitable combinations thereof. Computer storage media can be any computer-readable medium other than a computer-readable storage medium, which can be connected to an instruction execution system, apparatus, or device to enable communication, propagation, or transmission of a program for use. The program code located on the computer storage medium can be propagated through any suitable medium, including radio, cable, fiber optic cable, RF, or similar media, or any combination of the above media.
[0063] The computer program code required for the operation of each part of the embodiments in this specification can be written in any one or more programming languages, including object-oriented programming languages such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, Python, etc., conventional procedural programming languages such as C, Visual Basic, Fortran2003, Perl, COBOL2002, PHP, ABAP, dynamic programming languages such as Python, Ruby, and Groovy, or other programming languages. This program code can run entirely on the user's computer, or as a standalone software package on the user's computer, or partially on the user's computer and partially on a remote computer, or entirely on a remote computer or processing device. In the latter case, the remote computer can be connected to the user's computer through any network, such as a local area network (LAN) or wide area network (WAN), or connected to an external computer (e.g., via the Internet), or in a cloud computing environment, or used as a service such as Software as a Service (SaaS).
[0064] Furthermore, unless expressly stated in the claims, the order of processing elements and sequences, the use of numbers and letters, or other names described in the embodiments of this specification are not intended to limit the order of the processes and methods of the embodiments of this specification. Although some inventive embodiments that are currently considered useful have been discussed by way of various examples in the foregoing disclosure, it should be understood that such details are for illustrative purposes only, and the appended claims are not limited to the disclosed embodiments. Rather, the claims are intended to cover all modifications and equivalent combinations that conform to the spirit and scope of the embodiments of this specification. For example, although the system components described above can be implemented by hardware devices, they can also be implemented solely by software solutions, such as installing the described system on existing processing devices or mobile devices.
[0065] Similarly, it should be noted that, in order to simplify the description of the embodiments disclosed in this specification and thereby aid in the understanding of one or more embodiments of the invention, the foregoing description of the embodiments in this specification may sometimes combine multiple features into a single embodiment, drawing, or description thereof. However, this method of disclosure does not imply that the objects of the embodiments in this specification require more features than those mentioned in the claims. In fact, the embodiments have fewer features than all the features of the single embodiments disclosed above.
[0066] For each patent, patent application, patent application publication, and other material, such as articles, books, specifications, publications, and documents, referenced in this specification, the entire contents of which are incorporated herein by reference. This excludes historical application documents that are inconsistent with or conflict with this specification, as well as documents that limit the broadest scope of the claims of this application (currently or subsequently appended to this application). It should be noted that in the event of any inconsistency or conflict between the descriptions, definitions, and / or terminology used in the supplementary materials to this specification and the content of this specification, the descriptions, definitions, and / or terminology used in this specification shall prevail.
[0067] Finally, it should be understood that the embodiments described in this specification are merely illustrative of the principles of the embodiments described herein. Other variations may also fall within the scope of the embodiments described herein. Therefore, alternative configurations of the embodiments described herein are intended to be consistent with the teachings of this specification, rather than as examples or limitations. Accordingly, the embodiments described herein are not limited to those explicitly introduced and described herein.
Claims
1. A data caching method, executed on a computing device, comprising: Start the data caching service process within the container; The container is equipped with a data caching client corresponding to the data caching service process, and the data caching client is called by the computing process in the container. The data caching client determines the data request of the computing process in the container and transmits the data request to the data caching service process. The data caching service process obtains the metadata of the data corresponding to the data request and returns it to the data caching client. The data caching client determines the data corresponding to the data request based on the metadata and submits it to the computing process for use. The process address space of the data caching service process and the process address space of the computing process correspond to the same cached data file, and the metadata includes the relative position information of the data corresponding to the data request in the process address space.
2. The method of claim 1, wherein the data request includes a target data identifier; The data caching service process obtains the metadata of the data corresponding to the data request, including: The data caching service process determines whether its process address space contains the corresponding target data based on the target data identifier. If included, the storage offset and storage length of the target data in its process address space are determined by the data caching service process, and the storage offset and storage length are used as the metadata.
3. The method as described in claim 2, further comprising obtaining the metadata of the data corresponding to the data request through the data caching service process: If not included, the target data corresponding to the target data identifier is obtained from the storage area outside the container through the data caching service process, and mapped to its process address space; at the same time, the target data corresponding to the target data identifier is mapped to the process address space of the computing process through the data caching client; the storage offset and storage length of the target data in its process address space are determined by the data caching service process, and the storage offset and storage length are used as the metadata.
4. The method as described in claim 3, wherein the target data corresponding to the target data identifier is obtained from a storage area outside the container through a data caching service process, comprising: The data caching service process searches for the storage area where the target data is located in the partition index of the cache table based on the target data identifier. If the storage area is located on other computing devices, a data query request is initiated to the other computing devices via the network, and the target data is stored on this computing device so that the target data is mapped to the process address space of the data caching service process and the computing process, respectively.
5. The method as described in claim 4, further comprising obtaining the target data corresponding to the target data identifier from a storage area outside the container via a data caching service process: The target data is converted into a columnar data storage format and then stored on this computing device. The columnar data storage format includes the Apache Arrow format; The target data identifier includes the target partition identifier and / or the target column identifier; correspondingly, the target data includes the target partition and / or the target column.
6. The method as described in claim 5, wherein determining the data corresponding to the data request based on the metadata through the data caching client, and submitting it to the computing process for use, includes using the data caching client: The storage location of the target data in the process mapping space of the computing process is determined based on the metadata; The Apache Arrow algorithm reads the data corresponding to the client's data retrieval request based on the storage location and submits it to the computing process for use. Alternatively, this could include caching data on the client side: The storage location of the target data in the process mapping space of the computing process is determined based on the metadata; Based on the storage location, obtain the data in columnar data storage format corresponding to the data request; The data in the columnar data storage format is converted into row-based data and submitted to the computing process for use; Alternatively, this could include caching data on the client side: The metadata is passed to the columnar scanner in the computation process so that the columnar scanner can perform vectorized computation based on the data in the columnar data storage format corresponding to the data request. The columnar scanner comes from the OLAP analysis engine.
7. The method of claim 3, further comprising: The data caching service process reclaims at least a portion of its process address space based on a preset eviction mechanism in order to map new target data into its process address space.
8. The method of claim 7, wherein the step of reclaiming at least a portion of the space in the process address space of the data caching service process based on a preset eviction mechanism includes, through the data caching service process: Determine the data being accessed by the computation process in the process address space from the data cache client; The at least portion of the space to be reclaimed will be reclaimed when the data corresponding to the space to be reclaimed is not accessed by the computing process.
9. A data caching system for deployment in a computing device, comprising: The data caching service module is used to start within a container on a computing device, and thus become a data caching service process. A data caching client is used to obtain the data request of the computing process when it is invoked by the computing process in the container, and to transmit the data request to the data caching service process; The data caching service process is used to obtain the metadata of the data corresponding to the data request and return it to the data caching client; The data caching client is also used to determine the data corresponding to the data request based on the metadata, so as to submit it to the computing process for use; The process address space of the data caching service process and the process address space of the computing process correspond to the same cached data file, and the metadata includes the relative position information of the data corresponding to the data request in the process address space.
10. A data caching device, comprising a processor and a storage medium storing computer instructions, the processor being configured to execute at least a portion of the computer instructions to implement the method as claimed in any one of claims 1 to 8.
Citation Information
Patent Citations
Metadata caching method and system, equipment and medium
CN112115170A
Data caching processing method and system, calculation equipment and readable storage medium
CN113032432A