Elastic column cache of cloud database

By dynamically adjusting the cloud database's columnar cache and optimizing memory usage based on access frequency, the slow response speed problem caused by the row-major storage format in the cloud database is solved, achieving more efficient memory resource utilization and cost reduction.

CN115803728BActive Publication Date: 2025-09-26GOOGLE LLC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202180049302.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-07-20
Filing Date
2021-05-04
Publication Date
2025-09-26
Estimated Expiration
2041-05-04

AI Technical Summary

Technical Problem

The row-based storage format in cloud databases results in slow response times for data requests. The size of existing column-based caches is static and cannot be adjusted dynamically, making it difficult to effectively utilize storage resources.

Method used

By receiving cache configuration information, it dynamically adjusts the subset of multiple columns cached in a column-major format, expands or shrinks the cache size in real time according to the access frequency, and optimizes memory usage using virtual horizontal partitioning technology.

Benefits of technology

It improves data access speed, optimizes memory resource utilization, reduces costs, and improves cache response efficiency and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115803728B_ABST
    Figure CN115803728B_ABST
Patent Text Reader

Abstract

A method includes receiving cache configuration information (22) indicating a maximum size (24) and an increment size (26) of a cache (160) associated with a user (12). The cache is configured to store a portion of a table (158) in a row-major format. The method includes caching a subset of a plurality of columns (310) of the table in the cache in a column-major format and receiving a plurality of data requests requesting access to the table and associated with corresponding access patterns (180) requiring access to one or more columns. While executing one or more workloads, the method includes, for each column of the table, determining an access frequency (182) indicating a number of times the corresponding column was accessed in a predetermined time period, and dynamically adjusting the subset of columns based on the access pattern, the maximum size, and the increment size.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to an elastic columnar cache for a cloud database. Background Art

[0002] Cloud databases are typically large in size and are stored in a row-major format. That is, the elements of a row are stored consecutively in memory (i.e., contiguously). However, data requests (e.g., from users) are typically column-centric. For example, a user requests the employee ID (i.e., a column of data) for each employee in the database. In this case, storage in a row-major format significantly affects response speed because the required data is split across a large number of locations in memory. To address this issue, cloud databases typically implement a columnar cache. This cache stores one or more columns of the database in a column-major format. The size of a columnar cache and which columns are stored in the cache are typically static and require a reboot to change. Summary of the Invention

[0003] One aspect of the present invention provides a method for providing an elastic columnar cache. The method includes receiving cache configuration information at data processing hardware, the cache configuration information indicating a maximum size and an incremental size of a cache associated with a user. The cache is configured to store a portion of a table stored on memory hardware that communicates with the data processing hardware. The table is stored on the memory hardware in a row-major format and includes multiple columns and multiple rows. The method also includes caching, by the data processing hardware, a subset of multiple columns of the table in a cache associated with the user in a column-major format. The method includes receiving multiple data requests at the data processing hardware. Each data request requests access to the table stored on the memory hardware and is associated with a corresponding access pattern that requires access to one or more of the multiple columns of the table.

[0004] The method includes, while executing one or more workloads on data processing hardware, determining, for each of a plurality of columns of a table, an access frequency indicating a number of times the corresponding column is accessed in a predetermined time period based on a corresponding access pattern associated with each of a plurality of data requests. The method also includes dynamically adjusting, in real time, a subset of the plurality of columns of a column-major format cache based on the access pattern, a maximum size of the cache, and an incremental size of the cache.

[0005] Implementations of the present disclosure may include one or more of the following optional features. In some implementations, dynamically adjusting a subset of a plurality of columns of a column-major format cache includes removing one or more columns from the subset of a plurality of columns in the cache. The removed one or more columns are associated with an access frequency that satisfies a shrinking access frequency threshold. Optionally, dynamically adjusting a subset of a plurality of columns of a column-major format cache includes adding one or more columns to the subset of a plurality of columns in the cache. The added one or more columns are associated with an access frequency that satisfies an expanding access frequency threshold.

[0006] In some examples, the column-major format includes a virtual horizontal partition of the row-major format. Caching the subset of the plurality of columns may include generating one or more table fragments, each table fragment including a respective portion of one or more of the plurality of columns of the table. In some implementations, the cache includes a shared memory accessible by one or more workloads executing on the data processing hardware.

[0007] Dynamically adjusting a subset of the plurality of columns of the column-major format cache may include dynamically adjusting the subset of the plurality of columns of the column-major format cache without restarting any of the one or more workloads. In some examples, dynamically adjusting the subset of the plurality of columns of the column-major format cache includes one of: increasing a size of the cache by an amount equal to the increment size, or decreasing a size of the cache by an amount equal to the increment size.

[0008] Optionally, the method further includes, before dynamically adjusting the subset of the plurality of columns by increasing the size of the cache by an amount equal to the incremental size, determining, by the data processing hardware, whether increasing the cache by an amount equal to the incremental size would exceed a maximum size. When increasing the cache by an amount equal to the incremental size would exceed the maximum size, the method includes refusing, by the data processing hardware, to increase the size of the cache. In some implementations, the cache includes a plurality of segments, and dynamically adjusting the subset of the plurality of columns of the column-major format cache includes grouping the columns together in the segments based on access patterns. Grouping the columns together in the segments based on access patterns may include grouping together infrequently accessed columns.

[0009] Another aspect of the present invention provides a system for elastic columnar caching. The system includes data processing hardware and memory hardware in communication with the data processing hardware. The memory hardware stores instructions that, when executed on the data processing hardware, cause the data processing hardware to perform operations. The operations include receiving cache configuration information that indicates a maximum size and an incremental size of a cache associated with a user. The cache is configured to store a portion of a table stored on the memory hardware in communication with the data processing hardware. The table is stored in a row-major format on the memory hardware and includes multiple columns and multiple rows. The operations also include caching a subset of the multiple columns of the table in a cache associated with the user in a column-major format. The operations include receiving multiple data requests. Each data request requests access to the table stored on the memory hardware and is associated with a corresponding access pattern that requires access to one or more of the multiple columns of the table.

[0010] The operations include, while executing one or more workloads on data processing hardware, determining, for each of a plurality of columns of a table, an access frequency indicating a number of times the corresponding column is accessed in a predetermined time period based on a corresponding access pattern associated with each of a plurality of data requests. The operations also include dynamically adjusting, in real time, a subset of the plurality of columns of a column-major format cache based on the access pattern, a maximum size of the cache, and an incremental size of the cache.

[0011] This aspect may include one or more of the following optional features. In some implementations, dynamically adjusting a subset of a plurality of columns of a column-major format cache includes removing one or more columns from the subset of a plurality of columns in the cache. The removed one or more columns are associated with an access frequency that satisfies a shrinking access frequency threshold. Optionally, dynamically adjusting a subset of a plurality of columns of a column-major format cache includes adding one or more columns to the subset of a plurality of columns in the cache. The added one or more columns are associated with an access frequency that satisfies an expanding access frequency threshold.

[0012] In some examples, the column-major format includes a virtual horizontal partition of the row-major format. Caching the subset of the plurality of columns may include generating one or more table fragments, each table fragment including a respective portion of one or more of the plurality of columns of the table. In some implementations, the cache includes a shared memory accessible by one or more workloads executing on the data processing hardware.

[0013] Dynamically adjusting a subset of the plurality of columns of the column-major format cache may include dynamically adjusting the subset of the plurality of columns of the column-major format cache without restarting any of the one or more workloads. In some examples, dynamically adjusting the subset of the plurality of columns of the column-major format cache includes one of: increasing a size of the cache by an amount equal to the increment size, or decreasing a size of the cache by an amount equal to the increment size.

[0014] Optionally, the operations further include, before dynamically adjusting the subset of the plurality of columns by increasing the size of the cache by an amount equal to the incremental size, determining whether increasing the cache by an amount equal to the incremental size exceeds a maximum size. When increasing the cache by an amount equal to the incremental size would exceed the maximum size, the operations include refusing to increase the size of the cache. In some implementations, the cache includes a plurality of segments, and dynamically adjusting the subset of the plurality of columns of the column-major format cache includes grouping the columns together in the segments based on access patterns. Grouping the columns together in the segments based on access patterns may include grouping together infrequently accessed columns.

[0015] The details of one or more implementations of the disclosure are set forth in the accompanying drawings and the description below. Other aspects, features, and advantages will be apparent from the description and drawings, and from the claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a diagram of an example system for elastic columnar caching.

[0017] Figure 2 is a diagram illustrating exemplary components of an elastic columnar cache.

[0018] Figures 3A-3C Schematic diagram of the memory segments of the elastic columnar cache that dynamically expands and contracts.

[0019] Figure 4 is a flow diagram of an exemplary arrangement of operations for a method of providing elastic columnar caching.

[0020] Figure 5 is a schematic diagram of an exemplary computing device that can be used to implement the systems and methods described herein.

[0021] Like reference numbers in the various drawings represent like elements. DETAILED DESCRIPTION

[0022] Database systems (e.g., cloud database systems) typically include a certain amount of shared memory that acts as a cache, storing frequently accessed data in a column-major format. This cache is used to significantly improve access speed to frequently accessed data compared to data stored in a row-major format (e.g., data stored on a hard disk). This "in-memory cache" feature efficiently serves analytical queries by caching a subset of database tables / columns in memory in a column-major format. Column-based caching improves performance by reading only relevant columns (based on the query), which offers better compression support and vectorized execution.

[0023] Typically, these cloud database systems statically allocate shared memory and lock the size of the column cache (and the columns stored in it) at system or instance startup. Because the column cache size is determined at server startup and is static, users cannot increase or decrease the cache size without restarting the server.

[0024] When running an analytical workload, query patterns (e.g., query patterns from users requesting access to data stored in a database) often reveal that queries access a set of tables / columns more frequently than other tables / columns. Furthermore, columns that are never accessed or rarely accessed (i.e., columns selected at startup) may be stored in the cache. Because the columnar cache size is static, the database server cannot free up shared columnar cache memory for tables / columns that are infrequently accessed by the workload to replace them with more frequently accessed columns / tables (thereby increasing the effectiveness of the cache). Furthermore, the database server cannot typically increase the size of the shared columnar cache to add more tables / columns to the cache beyond the statically defined capacity (i.e., defined at startup).

[0025] This paper implements an elastic columnar cache system for cloud databases. This system implements a columnar cache that stores data in table fragments consisting of virtual horizontal partitions of row-major data. That is, several consecutive blocks of rows (from data stored in row-major format) are converted to column-major format, resulting in independent and self-describing table fragments. Within a table fragment, all column values ​​can be physically stored together in sorted order, enabling faster aggregation and predicate filtering.

[0026] The elastic column cache system automatically determines and designates frequently accessed tables and / or columns for column caching. The system dynamically allocates the required shared memory (while the database is running) to store the designated tables / columns in the shared memory. The system also reclaims the shared memory when the cached columns or tables are no longer needed (i.e., rarely accessed). Thus, the elastic column cache system provides runtime elasticity by transparently expanding and contracting / reducing the shared memory used for column caching to the user. Because users are often billed based on the amount of memory dedicated to or allocated to them, the elastic column cache system not only provides more efficient and effective use of shared memory, but also reduces costs.

[0027] Now refer to Figure 1 In some implementations, the exemplary columnar cache system 100 includes a remote system 140 that communicates with one or more user devices 10 via a network. The remote system 140 can be a single computer, multiple computers, or a distributed system (e.g., a cloud environment) with scalable / elastic resources 142, including computing resources 144 (e.g., data processing hardware) and / or storage resources 146 (e.g., memory hardware). A data block data store 150 (i.e., a remote storage device) can overlay the storage resources 146 to allow one or more clients (e.g., user devices 10) or computing resources 144 to scalably use the storage resources 146. The data store 150 is configured to store multiple data blocks 152, 152an in one or more tables 158, 158an (i.e., a cloud database), each of which includes multiple rows and columns 310, 310Aa-Nn (Figure 3). The data store 150 can store any number of tables 158 at any point in time. In some examples, table 158 is stored using a row-major format. That is, each data block 152 is stored so that consecutive elements of a row are consecutive in memory.

[0028] Remote system 140 also includes an elastic columnar cache 160 that is configured to store one or more columns of one or more tables 158 in a column-major format. That is, elastic columnar cache 160 stores a portion of one or more tables 158 stored in block data store 150 in a manner such that consecutive elements of a column 310 are contiguous. Elastic columnar cache 160 may include shared memory that is accessible by any number of processes (e.g., workloads or applications) executing on remote system 140. Optionally, elastic columnar cache includes memory having a faster access time than block data store 150. For example, block data store 150 may be a hard disk or other non-volatile memory, while elastic columnar cache 160 may be random access memory.

[0029] Now refer to Figure 2In some examples, the elastic columnar cache 160 includes one or more table segments 200, 200AA-Nn, for each table 158, where each table segment 200 includes a corresponding portion of one or more columns 310 of one or more tables 158. A table segment 200 represents a virtual horizontal partitioning of data blocks in a row-major format (i.e., data blocks 152 stored in the data block data store 150). Each table segment 200 may include a fixed number of data blocks 152 (e.g., 4096 data blocks 152) representing values ​​of a column 310 stored in sorted order. That is, each table segment 200 includes sorted data blocks 152 for one or more columns 310 of a table 158. In the example shown, the elastic columnar cache 160 includes N table segments 200 for table A 158A, and each table segment 200 includes 4096 data blocks 152 representing one or more columns 310 of table 158A. The elastic columnar cache 160 may include any number of table segments 200, and each table segment 200 may include any number of data blocks 152. While in some implementations, each table segment 200 has the same size (i.e., includes the same number of data blocks 152), in other implementations, the table segments 200 have different sizes.

[0030] In some examples, the entirety of a column 310 is contiguous in one or more table fragments 200. In other examples, a column 310 may be split into two or more table fragments 200. This allows the system 100 to skip and / or filter table fragments 200 that do not satisfy the predicates specified in the data request during the execution of the data request 20. For example, the controller 170 maintains minimum and maximum column values ​​for each column 310 in each table fragment 200. The minimum and maximum column values ​​for each table fragment 200 may represent only the data present in the corresponding table fragment 200, which provides for faster predicate pruning. For example, by simply applying predicates to the minimum and maximum values ​​when processing the data request 20, several table fragments 200 may be quickly eliminated.

[0031] Back to Figure 1 , the remote system 140 is configured to receive data requests 20 (i.e., queries) from user devices 10 associated with respective users 12. The user devices 10 may correspond to any computing device, such as a desktop workstation, a laptop workstation, or a mobile device (i.e., a smartphone). The user devices 10 include computing resources 18 (e.g., data processing hardware) and / or storage resources 16 (e.g., memory hardware). Each data request 20 requests the remote system 140 to read and / or write one or more data blocks 152 within a table 158 stored on a data block data store 150.

[0032] The remote system 140 executes the elastic column cache controller 170. The controller 170 receives cache configuration information 22 directly or indirectly from the user device 10. In some implementations, the cache configuration information 22 indicates a maximum size 24 and an incremental size 26 of the column cache 160. Optionally, the cache configuration information 22 includes an initial size 28 of the column cache 160. The maximum size 24 indicates to the controller 170 the maximum amount of cache (i.e., memory) that can be allocated by the remote system 140 for use by the user 12 associated with the cache configuration information 22. The incremental size 26 indicates the amount of memory that the controller 170 can allocate by increasing or decreasing the size of the elastic column cache 160 when dynamically adjusting the size of the cache 160. That is, the incremental size 26 defines the amount of memory that the controller 170 can allocate to or deallocate from the elastic column cache 160 when dynamically adjusting the size of the cache 160.

[0033] For example, cache configuration information 22 indicates that maximum size 24 is 4 gigabytes and incremental size 26 is 1 gigabyte. In this example, controller 170 may allocate up to 4 gigabytes of elastic columnar cache 160 to user 12 at any one time and may increase or decrease the current amount allocated to user 12 by 1 gigabyte at a time (up to a maximum size 24 of 4 gigabytes). For example, when there are two gigabytes allocated to user 12, controller 170 may expand the total amount allocated to user 12 to three gigabytes, or reduce the total amount allocated to user 12 to two gigabytes. In some instances, initial size 28 indicates to controller 170 the initial size of elastic columnar cache 160. Initial size 28 may also represent the minimum size of elastic columnar cache 160. For example, when initial size 28 is one gigabyte, controller 170 may initialize elastic columnar cache 160 to one gigabyte and may not reduce the total size allocated to user 12 to less than one gigabyte.

[0034] Based on the cache configuration information 22, the controller 170 caches a subset of the plurality of columns 310 of one or more tables 158 associated with the user 12 in the elastic columnar cache 160 using a column-major format. The user 12 may select the initial columns 310 to be cached in the elastic columnar cache 160. Alternatively, the controller 170 may select the columns 310 (e.g., randomly or based on data associated with the user 12, other users, or the tables 158). The controller 170 may cache a sufficient number of columns 310 to fill the elastic columnar cache 160 to an initial size of 28. The number of columns 310 cached by the controller 170 depends on the size of the columns 310 (i.e., the number of rows in the table 158) and the cache configuration information 22 (e.g., the initial size of 28).

[0035] Continue to refer Figure 1Controller 170 receives one or more data requests 20 (i.e., queries) from user device 10, each data request 20 requesting access to one or more tables 158 stored in data block data storage 150. Elastic columnar cache controller 170 determines whether the data requested in each received data request 20 is present in elastic columnar cache 160 (i.e., a "cache hit"). When the requested data is available in cache 160, controller 170 retrieves data 152 from cache 160 and sends a query response 172 containing the requested data 152 to user 12 via user device 10. When the requested data is not available or is only partially available in elastic columnar cache 160 (i.e., a "cache miss"), controller 170 retrieves the requested data 152 from data block data storage 150 and sends a query response 172 containing the requested data 152 to user 12 via user device 10.

[0036] When one or more workloads (e.g., processes having or requesting access to the elastic columnar cache 160 and / or the data block data store 150) are executed on the remote system 140, the elastic columnar cache controller 170 stores or otherwise retains an access pattern 180 associated with each data request 20. The access pattern 180 includes which columns 310 the controller 170 accesses in response to the data request 20. When the controller 170 stores the access pattern 180 for each data request 20, the controller 170 can determine an access frequency 182 for each column 310, indicating how often the data request 20 accesses the corresponding column 310 of the corresponding table 158 over a predetermined time period based on the corresponding access pattern 180. For example, the access frequency 182 indicates that some columns 310 are never accessed by the data request 20, or are rarely accessed by the data request 20 (e.g., weekly or monthly), while other columns 310 are frequently accessed by the data request 20 (e.g., hourly or daily).

[0037] The elastic columnar cache controller 170 dynamically adjusts, in real time, the subset of columns 310 cached in the elastic columnar cache 160 in a column-major format based on the access pattern 180 and the access frequency 182, as well as the cache configuration information 22 (e.g., the maximum size 24 and the increment size 26), while still executing one or more workloads. That is, the elastic columnar cache controller 170 determines which columns 310 are frequently accessed and which columns 310 are infrequently accessed based on the access frequency 182, and dynamically adjusts the elastic columnar cache 160 so that the frequently accessed columns 310 are present in the cache 160, while the infrequently accessed columns 310 are not present in the cache 160. This allows the controller 170 to dynamically adjust the elastic columnar cache 160, resulting in more "cache hits," while keeping the total size of the cache 160 allocated to the user 12 within the maximum size 24 indicated by the cache configuration information 22. In some examples, the controller 170 adjusts the size of the cache 160 by increasing the size by an amount equal to the increment size 26 or decreasing the size of the cache 160 by an amount equal to the increment size 26. Thus, the controller 170 dynamically adjusts a subset of the columns 310 cached in a column-major format without restarting any workloads accessing the cache 160 (i.e., the shared memory).

[0038] Now refer to Figures 3A-3C In some implementations, the elastic column cache 160 includes one or more memory segments 300, 300an. Each memory segment 300 may be a fixed size equal to the increment size 26 defined in the cache configuration information 22. For example, when the increment size 26 is one gigabyte, each memory segment 300 is one gigabyte in size. Therefore, when dynamically adjusting the columns 310 cached in the elastic column cache 160, the controller 170 may increase or decrease the size of the cache 160 (as needed) by one memory segment 300 at a time. Figure 3A In the example shown, memory segment 300a includes portions of table A 158A and table B 158B. The portion of table A 158A includes two table segments 200Aa, 200Ab. Segments 200Aa, 200Ab include column A 310Aa and column B 310Ab of table A 158A. The portion of table B 158B also includes two table segments 200Ba, 200Bb, but in this case, the table segments 200Ba, 200Bb include three columns 310Ba, 310Bb, 310Bc.

[0039] In some examples, dynamically adjusting the subset of columns 310 cached in the column-major format in the elastic column cache 160 includes adding one or more columns 310 to the subset associated with the access frequency 182 that satisfies the extended access frequency threshold. Figure 3BAs shown, adding a column 310 may include adding an additional memory segment 300. Here, the controller 170 dynamically expands the elastic columnar cache 160 from one memory segment 300 (i.e., memory segment A 300a) to two memory segments 300a, 300b. The second memory segment 300b contains the additional column 310 from table A 158A and a column 310 from a new table C 158C. That is, in this case, the access pattern 180 and access frequency 182 indicate that column C 310Ac and column D 310Ad of table A 158A, and column A 310Ca, column B 310Cb, and column C 310Cc of table C 158C are accessed frequently enough to meet the expanded access frequency threshold and, therefore, warrant inclusion in the elastic columnar cache 160. In this example, the controller 170 dynamically resizes (i.e., without restarting any workloads, processes, or applications) the elastic columnar cache 160 by adding the second memory segment 300b, thereby doubling the size.

[0040] The controller 170 may also add a column 310 to the elastic columnar cache 160 without adding an additional memory segment 300. For example, the controller 170 may add a column to an existing memory segment by utilizing a previously unused portion of a memory segment 300 or by replacing a less frequently accessed column 310 in a memory segment 300.

[0041] In some implementations, the controller 170 dynamically adjusts a subset of columns 310 of a column-major format cache by removing one or more columns 310 from the subset associated with an access frequency 182 that does not meet a shrinking access frequency threshold. The shrinking access frequency can be the same threshold as the expanding access frequency or a completely different threshold. Figure 3C In the example shown, the controller 170 dynamically shrinks the amount of cache allocated to the user 12 by releasing the shared memory associated with the memory segment A 300a and leaving only the memory segment B 300b allocated to the user 12. That is, in this case, the access frequency 182 of the columns 310 (i.e., columns 310Aa, 310Ab, 310Ba, 310Bb, 310Bc) cached in the memory segment A 300a meets the shrink access frequency threshold. For example, the access frequency 182 associated with the columns 310Aa, 310Ab, 310Ba, 310Bb, 310Bc indicates that these columns are not frequently accessed, and therefore the controller 170 can safely recover the memory associated with the memory segment A 300a.

[0042] In some examples, the controller 170 groups or assembles or otherwise aggregates the columns 310 into segments 300 based on the access pattern 180 and / or the access frequency 182. For example, the controller 170 groups the most frequently accessed columns 310 into the same memory segment 300 and groups the least frequently accessed columns 310 into the same memory segment 300. Figure 3B For example, columns 310Aa, 310Ab, 310Ba, 310Bb, and 310Bc may be grouped into memory segment A 300a based on corresponding access patterns 180 indicating that these columns are accessed more frequently than columns 310Ac, 310Ad, 310Ca, 310Cb, and 310Cc of memory segment B 300b. This enables the controller 170 to more easily and efficiently expand and shrink the size of the elastic columnar cache 170, as the controller 170 typically must wait for all current accesses to a memory segment 300 to complete before adjusting (e.g., removing) the memory segment 300. Thus, by reducing accesses to the memory segment 300 (i.e., by grouping less frequently accessed columns 310), the controller 170 can more easily recover the memory segment 300 when dynamically shrinking or reducing the size of the elastic columnar cache 160.

[0043] In some examples, before dynamically adjusting a subset of cached columns 310 by increasing the size of cache 160 by an amount equal to the increment size 26, controller 170 determines whether increasing the cache would exceed a maximum size 24 of cache 160. When increasing cache 160 would exceed the maximum size 24, controller 170 may refuse to increase the size of cache 160. Instead, controller 170 may adjust columns 310 grouped in one or more existing memory segments 300.

[0044] For example, continue to refer to Figure 3BIn this example, when the size of each memory segment 300 is one gigabyte and the maximum size of cache 160 is two gigabytes, both memory segments 300a, 300b allocate the largest amount of cache 160 to the associated user 12. In this case, when access patterns 180 indicate that additional columns 310 should be added to cache 160, controller 170 may replace one or more columns 310 with less frequently accessed patterns in one of memory segments 300a, 300b, rather than increasing the size of cache 160. When none of the currently cached columns 310 is accessed less frequently than the new columns 310 to be cached, controller 170 may instead deny any action and wait for access patterns to change. For example, after a period of time, one or more columns 310 may be accessed less frequently, and at that time, controller 170 may adjust the cached columns 310 based on the corresponding access patterns 180. Alternatively, controller 170 may receive a new maximum size 24 from user 12, allowing controller 170 to further increase the size of cache 160. In some examples, remote system 140 may notify user 12 when cache 160 reaches a maximum size and / or when controller 170 is unable to increase the size of cache 160 based on maximum size 24 .

[0045] Figure 4 4 is a flow chart of an exemplary arrangement of operations for a method 400 for elastic columnar caching. At operation 402, the method 400 includes receiving cache configuration information 22 at the data processing hardware 144, the cache configuration information 22 indicating a maximum size 24 and an increment size 26 of a cache 160 associated with a user 12. The cache 160 is configured to store a portion of a table 158 stored on the memory hardware 146 in communication with the data processing hardware 144. The table 158 is stored on the memory hardware 146 in a row-major format and includes a plurality of columns 310 and a plurality of rows.

[0046] At operation 404, the method 400 includes caching, by the data processing hardware 144, a subset of the plurality of columns 310 of the table 158 in a column-major format in a cache 160 associated with the user 12. At operation 406, the method 400 includes receiving, at the data processing hardware 144, a plurality of data requests 20. Each data request 20 requests access to the table 158 stored on the memory hardware 146 and is associated with a corresponding access pattern 180 requiring access to one or more of the plurality of columns 310 of the table 158.

[0047] When executing one or more workloads on the data processing hardware 144, the method 400 includes, at operation 408, determining, by the data processing hardware 144, for each column 310 of the plurality of columns 310 of the table 158, an access frequency 182 indicating a number of times the corresponding column 310 is accessed within a predetermined time period based on a corresponding access pattern 180 associated with each of the plurality of data requests 20. At operation 410, the method 400 includes dynamically adjusting, by the data processing hardware 144, in real time, a subset of the plurality of columns 310 cached in the column-major format based on the access pattern 180, the maximum size 24 of the cache 160, and the incremental size 26 of the cache 160.

[0048] Figure 5 is a schematic diagram of an exemplary computing device 500 that can be used to implement the systems and methods described in this document. Computing device 500 is intended to represent various forms of digital computers, such as laptops, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The components shown here, their connections and relationships, and their functions are merely exemplary and are not intended to limit implementations of the inventions described and / or claimed in this document.

[0049] Computing device 500 includes a processor 510, memory 520, storage device 530, a high-speed interface / controller 540 connected to memory 520 and a high-speed expansion port 550, and a low-speed interface / controller 560 connected to a low-speed bus 570 and storage device 530. Each of components 510, 520, 530, 540, 550, and 560 is interconnected using various buses and can be mounted on a common motherboard or otherwise as appropriate. Processor 510 can process instructions for execution within computing device 500, including instructions stored in memory 520 or on storage device 530, to display graphical information of a graphical user interface (GUI) on an external input / output device (e.g., display 580 coupled to high-speed interface 540). In other implementations, multiple processors and / or multiple buses, as well as multiple memories and memory types, can be used as appropriate. Furthermore, multiple computing devices 500 can be connected, with each device providing portions of the necessary operations (e.g., as a server bank, a group of blade servers, or a multi-processor system).

[0050] Memory 520 stores information non-transitorily within computing device 500. Memory 520 may be a computer-readable medium, a volatile memory unit, or a non-volatile memory unit. Non-transitory memory 520 may be a physical device used to temporarily or permanently store programs (e.g., sequences of instructions) or data (e.g., program state information) used by computing device 500. Examples of non-volatile memory include, but are not limited to, flash memory and read-only memory (ROM) / programmable read-only memory (PROM) / erasable programmable read-only memory (EPROM) / electrically erasable programmable read-only memory (EEPROM) (e.g., commonly used for firmware, such as bootloaders). Examples of volatile memory include, but are not limited to, random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), phase change memory (PCM), and magnetic disk or tape.

[0051] The storage device 530 can provide mass storage for the computing device 500. In some implementations, the storage device 530 is a computer-readable medium. In various implementations, the storage device 530 can be a floppy disk device, a hard disk device, an optical disk device, or a magnetic tape device, a flash memory or other similar solid-state memory device, or an array of devices, including devices in a storage area network or other configuration. In other implementations, a computer program product is tangibly embodied in an information carrier. The computer program product includes instructions that, when executed, perform one or more methods, such as those described above. The information carrier is a computer or machine-readable medium, such as the memory 520, the storage device 530, or a memory on the processor 510.

[0052] The high-speed controller 540 manages bandwidth-intensive operations of the computing device 500, while the low-speed controller 560 manages less bandwidth-intensive operations. This division of responsibilities is exemplary only. In some implementations, the high-speed controller 540 is coupled to the memory 520, the display 580 (e.g., via a graphics processor or accelerator), and the high-speed expansion port 550, which can accept various expansion cards (not shown). In some implementations, the low-speed controller 560 is coupled to the storage device 530 and the low-speed expansion port 590. The low-speed expansion port 590, which can include various communication ports (e.g., USB, Bluetooth, Ethernet, wireless Ethernet), can be coupled to one or more input / output devices, such as a keyboard, a pointing device, a scanner, or a networking device, such as a switch or router, for example, via a network adapter.

[0053] The computing device 500 can be implemented in a variety of different forms, as shown. For example, it can be implemented as a standard server 500a, or multiple times as a laptop computer 500b in a group of such servers 500a, or as part of a rack server system 500c.

[0054] Various implementations of the systems and techniques described herein can be implemented in digital electronic and / or optical circuitry, integrated circuits, specially designed ASICs (application-specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementations in one or more computer programs executable and / or interpretable on a programmable system comprising at least one programmable processor, which can be special purpose or general purpose, coupled to receive data and instructions from and send data and instructions to a storage system, at least one input device, and at least one output device.

[0055] A software application (i.e., a software resource) may refer to computer software that enables a computing device to perform tasks. In some instances, a software application may be referred to as an "application," "application program," or "program." Example applications include, but are not limited to, system diagnostic applications, system management applications, system maintenance applications, word processing applications, spreadsheet applications, messaging applications, media streaming applications, social networking applications, and gaming applications.

[0056] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for a programmable processor and may be implemented in high-level procedural and / or object-oriented programming languages ​​and / or in assembly / machine language. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, non-transitory computer-readable medium, device, and / or apparatus (e.g., disks, optical disks, memories, programmable logic devices (PLDs)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and / or data to a programmable processor.

[0057] The processes and logic flows described in this specification can be performed by one or more programmable processors (also known as data processing hardware) executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows can also be performed by dedicated logic circuits, such as FPGAs (field programmable gate arrays) or ASICs (application-specific integrated circuits). For example, processors suitable for executing computer programs include general-purpose and special-purpose microprocessors, as well as any one or more processors of any type of digital computer. Typically, a processor will receive instructions and data from a read-only memory or a random access memory, or both. The basic elements of a computer are a processor for executing instructions and one or more memory devices for storing instructions and data. Typically, a computer will also include or be operably coupled to receive data from or transfer data to one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks. However, a computer need not have such devices. Computer-readable media suitable for storing computer program instructions and data include all forms of nonvolatile memory, media, and storage devices, including, for example, semiconductor memory devices, such as EPROM, EEPROM, and flash memory devices; magnetic disks, such as internal hard disks or removable disks; magneto-optical disks; CD ROMs and DVD-ROM disks. The processor and memory can be supplemented by, or incorporated in, special purpose logic circuitry.

[0058] To provide for interaction with a user, one or more aspects of the present disclosure may be implemented on a computer having a display device, such as a CRT (cathode ray tube), an LCD (liquid crystal display) monitor, or a touch screen for displaying information to the user, and optionally also having a keyboard and a pointing device, such as a mouse or trackball, through which the user can provide input to the computer. Other types of devices may also be used to provide for interaction with the user; for example, feedback provided to the user may be any form of sensory feedback, such as visual feedback, auditory feedback, or tactile feedback; and input from the user may be received in any form, including sound, voice, or tactile input. In addition, a computer may interact with a user by sending documents to and receiving documents from a device used by the user; for example, by sending a web page to a web browser on a user's client device in response to a request received from the web browser.

[0059] A variety of implementations have been described. However, it will be appreciated that various modifications may be made without departing from the spirit and scope of the present disclosure. Therefore, other implementations are within the scope of the appended claims.

Claims

1. A method (400) for providing elastic column cache, characterized in that: include: Receiving cache configuration information (22) at data processing hardware (144), the cache configuration information (22) indicating a maximum size (24) and an incremental size (26) of a cache (160) associated with a user (12), the cache (160) configured to store a portion of a table (158) stored on memory hardware (146) in communication with the data processing hardware (144), the table (158) stored on the memory hardware (146) in a row-major format and including a plurality of columns (310) and a plurality of rows; caching, by the data processing hardware (144), a subset of the plurality of columns (310) of the table (158) in a column-major format in the cache (160) associated with the user (12); receiving, at the data processing hardware (144), a plurality of data requests (20), each data request (20) requesting access to the table (158) stored on the memory hardware (146) and associated with a corresponding access pattern (180) requiring access to one or more of the plurality of columns (310) of the table (158); and While executing one or more workloads on the data processing hardware (144): determining, by the data processing hardware (144), for each column (310) of the plurality of columns (310) of the table (158), an access frequency (182) indicating a number of times the corresponding column (310) is accessed in a predetermined time period based on the corresponding access pattern (180) associated with each of the plurality of data requests (20); and The subset of the plurality of columns (310) cached in the column-major format is dynamically adjusted in real time by the data processing hardware (144) based on the access pattern (180), the maximum size (24) of the cache (160), and the incremental size (26) of the cache (160).

2. The method (400) according to claim 1, characterized in that Dynamically adjusting the subset of the plurality of columns (310) of the column-major format cache includes removing one or more columns (310) from the subset of the plurality of columns (310) in the cache (160), the removed one or more columns (310) being associated with an access frequency (182) that satisfies a shrink access frequency (182) threshold.

3. The method (400) according to claim 1 or 2, characterized in that Dynamically adjusting the subset of the plurality of columns (310) of the column-major format cache includes adding one or more columns (310) to the subset of the plurality of columns (310) in the cache (160), the added one or more columns (310) being associated with an access frequency (182) that satisfies an expanded access frequency (182) threshold.

4. The method (400) according to claim 3, characterized in that The column-major format includes virtual horizontal partitions of the row-major format.

5. The method (400) according to claim 4, characterized in that Caching the subset of the plurality of columns (310) includes generating one or more table (158) fragments, each table (158) fragment including a respective portion of one or more columns (310) of the plurality of columns (310) of the table (158).

6. The method (400) according to claim 5, characterized in that The cache (160) comprises shared memory accessible by the one or more workloads executing on the data processing hardware (144).

7. The method (400) according to claim 6, characterized in that Dynamically adjusting the subset of the plurality of columns (310) cached in the column-major format includes dynamically adjusting the subset of the plurality of columns (310) cached in the column-major format without restarting any of the one or more workloads.

8. The method (400) according to claim 7, characterized in that Dynamically adjusting the subset of the plurality of columns (310) cached in the column-major format includes one of increasing the size of the cache (160) by an amount equal to the incremental size (26) or decreasing the size of the cache (160) by an amount equal to the incremental size (26).

9. The method (400) according to claim 8, characterized in that Also included, prior to dynamically adjusting the subset of the plurality of columns (310) by increasing the size of the cache (160) by an amount equal to the increment size (26): determining, by the data processing hardware (144), whether increasing the buffer (160) by an amount equal to the increment size (26) exceeds the maximum size (24); and The data processing hardware (144) refuses to increase the size of the cache (160) when increasing the cache (160) by an amount equal to the incremental size (26) would exceed the maximum size (24).

10. The method (400) according to claim 9, characterized in that The cache (160) includes a plurality of segments (300); and Dynamically adjusting the subset of the plurality of columns (310) cached in the column-major format includes grouping columns (310) together in segments (300) based on the access pattern (180).

11. The method (400) according to claim 10, characterized in that Grouping the columns (310) in segments (300) based on the access pattern (180) includes grouping infrequently accessed columns (310) together.

12. A system (100) for providing elastic column cache, characterized in that: include: Data processing hardware (144); and Memory hardware (146) in communication with the data processing hardware (144), the memory hardware (146) storing instructions that, when executed on the data processing hardware (144), cause the data processing hardware (144) to perform operations comprising: receiving cache configuration information (22), the cache configuration information (22) indicating a maximum size (24) and an incremental size (26) of a cache (160) associated with a user (12), the cache (160) being configured to store a portion of a table (158) stored on the memory hardware (146) in communication with the data processing hardware (144), the table (158) being stored on the memory hardware (146) in a row-major format and including a plurality of columns (310) and a plurality of rows; caching a subset of the plurality of columns (310) of the table (158) in a column-major format in the cache (160) associated with the user (12); receiving a plurality of data requests (20), each data request (20) requesting access to the table (158) stored on the memory hardware (146) and associated with a corresponding access pattern (180) requiring access to one or more of the plurality of columns (310) of the table (158); and While executing one or more workloads on the data processing hardware (144): determining, for each column (310) of the plurality of columns (310) of the table (158), an access frequency (182) indicating a number of times the corresponding column (310) is accessed in a predetermined time period based on the corresponding access pattern (180) associated with each of the plurality of data requests (20); and The subset of the plurality of columns (310) cached in the column-major format is dynamically adjusted in real time based on the access pattern (180), the maximum size (24) of the cache (160), and the incremental size (26) of the cache (160).

13. The system (100) according to claim 12, characterized in that Dynamically adjusting the subset of the plurality of columns (310) of the column-major format cache includes removing one or more columns (310) from the subset of the plurality of columns (310) in the cache (160), the removed one or more columns (310) being associated with an access frequency (182) that satisfies a shrink access frequency (182) threshold.

14. The system (100) according to claim 12 or 13, characterized in that Dynamically adjusting the subset of the plurality of columns (310) of the column-major format cache includes adding one or more columns (310) to the subset of the plurality of columns (310) in the cache (160), the added one or more columns (310) being associated with an access frequency (182) that satisfies an expanded access frequency (182) threshold.

15. The system (100) according to claim 14, characterized in that The column-major format includes virtual horizontal partitions of the row-major format.

16. The system (100) according to claim 15, characterized in that Caching the subset of the plurality of columns (310) includes generating one or more table (158) fragments, each table (158) fragment including a respective portion of one or more columns (310) of the plurality of columns (310) of the table (158).

17. The system (100) according to claim 16, characterized in that The cache (160) comprises shared memory accessible by the one or more workloads executing on the data processing hardware (144).

18. The system (100) of claim 17, wherein: Dynamically adjusting the subset of the plurality of columns (310) cached in the column-major format includes dynamically adjusting the subset of the plurality of columns (310) cached in the column-major format without restarting any of the one or more workloads.

19. The system (100) according to claim 18, characterized in that Dynamically adjusting the subset of the plurality of columns (310) cached in the column-major format includes one of increasing the size of the cache (160) by an amount equal to the incremental size (26) or decreasing the size of the cache (160) by an amount equal to the incremental size (26).

20. The system (100) according to claim 19, characterized in that The operations further include, prior to dynamically adjusting the subset of the plurality of columns (310) by increasing the size of the cache (160) by an amount equal to the increment size (26): determining whether increasing the buffer (160) by an amount equal to the increment size (26) exceeds the maximum size (24); and When increasing the size of the buffer (160) by an amount equal to the incremental size (26) would exceed the maximum size (24), increasing the size of the buffer (160) is denied.

21. The system (100) according to claim 20, characterized in that: The cache (160) includes a plurality of segments (300); and Dynamically adjusting the subset of the plurality of columns (310) cached in a column-major format includes grouping columns (310) together in segments (300) based on the access pattern (180).

22. The system according to claim 21, wherein: Grouping the columns (310) in segments (300) based on the access pattern (180) includes grouping infrequently accessed columns (310) together.

Citation Information

Patent Citations

  • Method and system for optimizing database performance

    US20050049992A1

  • Columnar caching in tiered storage

    US20170116269A1