Prev Source
Next Source

Dremel

original source

Here, have some highlights:

Highlights

Performing interactive data analysis at scale demands a high degree of parallelism. For example, reading a terabyte of compressed data from secondary storage in 1 s would require more than 10,000 commodity disks.


At Google, massively parallel computing is done using shared clusters of com- modity machines.


Dremel builds on ideas from Web search and parallel DBMSs.


First, its architecture borrows the concept of a serv-
ing tree used in distributed search engines.11
Just like a
Web search request, a query gets pushed down the tree and
is rewritten at each step. The result of the query is assem-
bled by aggregating the replies received from lower levels
of the tree.


Dremel uses a column-striped
storage representation, which enables it to read less data
from secondary storage and reduce CPU cost due to cheaper
compression. Column stores have been adopted for analyz-
ing relational data1 but to the best of our knowledge have
not been extended to nested data models. The columnar
storage format that we present is supported by many data
processing tools at Google, including MR, Sawzall,21
and
FlumeJava.


In this paper we make the following contributions: • We describe a novel columnar storage format for nested data. We present algorithms for dissecting nested records into columns and reassembling them (Section 4).
• We outline Dremel’s query language and execution.
Both are designed to operate efficiently on column- striped nested data and do not require restructuring of nested records (Section 5).
• We show how execution trees used in Web search sys- tems can be applied to database processing and explain their benefits for answering aggregation queries effi- ciently (Section 6).
• We present experiments on trillion-record, multi-­ terabyte datasets, conducted on system instances running on 1000–4000 nodes (Section 7).


The above scenario requires interoperation between the
query processor and other data management tools. The
first ingredient for that is a common storage layer. GFS14
is
one such distributed storage layer widely used in the com-
pany.


The second ingredient for building interoperable data management components is a shared storage format. Colum­nar storage proved successful for flat relational data but making it work for Google required adapting it to a nested data model.


The challenge that we address is how to pre- serve all structural information and be able to reconstruct records from an arbitrary subset of fields.


our goal is to store all values of a given field consecutively to improve retrieval efficiency. However, columnar data might eventually be consumed by record-oriented tools such as MR. Therefore, we need a way to assemble records efficiently from any given subset of col- umns.


In Figure 2, we have seen two documents represented as records. Contrast those to Figure 3. It depicts the same data in a columnar format. The values of every field are stored sequentially as a separate stripe. For each value, we keep extra information, a repetition level and a definition level (abbreviated as r and d in the figure). This information encodes the structure of the records.


A table is stored as a set of tablets. A tab- let is a self-contained horizontal partition of the table.


In addition to the actual data, the tablet contains the schema and extra meta- data that includes specification of keys, sorting order, value ranges, etc. ­


Each column is stored as a set of blocks. Each block con- tains the repetition and definition levels (henceforth, sim- ply called levels) and compressed field values.


NULLs are not stored explicitly as they are determined by the defini- tion levels.


Definition levels are not stored for values that are always defined. Similarly, repetition levels are stored only if required; for example, definition level 0 implies r ­epetition level 0, so the latter can be omitted.


Levels are packed as bit sequences. We only use as many bits as necessary; for example, if the maximum definition level is 3, we use 2 bits per definition level.


Assembling records from columnar data efficiently is criti- cal for record-oriented data processing tools (e.g., MR). Given a subset of fields, our goal is to reconstruct the origi- nal records as if they contained just the selected fields, with all other fields stripped away. The key idea is we create a finite state machine (FSM) that reads the field values and levels for each field, and appends the values sequentially to the output records. An FSM state corresponds to a field reader for each selected field. State transitions are labeled with repetition levels. Once a reader fetches a value, we look at the next repetition level to decide what next reader to use. The FSM is traversed from the start to end state once for each record.


Dremel’s query language is based on SQL and is designed to be efficiently implementable on columnar nested stor- age.


Dremel executes queries using a serving tree (see Figure 9). Its purpose is twofold: 1. To parallelize query scheduling and aggregation 2. To provide fault tolerance and deal with stragglers


Many Dremel queries are one-pass aggregations; therefore, we focus on explaining those and use them for experiments in the next section. We defer a detailed ­discussion of joins, indexing, updates, etc., to future work.


A root server receives incoming queries, reads metadata from the tables, and routes the queries to the next level in the serving tree. The leaf servers communicate with the stor- age layer or access the data on local disk.


Dremel supports query pro- cessing mechanisms that go beyond one-pass aggregation. These mechanisms are designed to leverage the serving tree architecture, too. For example, one way to execute a query that joins a large partitioned table with small user-defined tables is by sending a copy of the small tables to each leaf server. This strategy is referred to as broadcast join.


We found that serving trees are a useful building block that complements existing distributed query processing algorithms.


Dremel is a multiuser system, that is, usually several queries are executed simultaneously. A query dispatcher schedules queries based on their priorities and balances the load. Its other important role is to provide fault tolerance when one server becomes much slower than ­others or a tablet replica becomes unreachable.


During query execution, the query dispatcher computes a histogram of tablet processing times. If a tablet takes a disproportionately long time to pro- cess, it reschedules it on another server. Some tablets may need to be redispatched multiple times.


The leaf servers read stripes of nested data in columnar representation. The blocks in each stripe are prefetched asynchronously; the read-ahead cache typically achieves hit rates of 95%.


Tablets are usually three-way replicated. When a leaf server cannot access one tablet replica, it falls over to another replica.


The query dispatcher honors a parameter that specifies the minimum percentage of tablets that must be scanned before returning a result. As we demonstrate shortly, setting such parameter to a lower value (e.g., 98% instead of 100%) can often speed up execution significantly, especially when using smaller replication factors.


Dremel scans quadrillions of records per month.


most queries are processed under 10 s, well within the interactive range. Some queries achieve a scan throughput close to 100 billion records per second on a shared cluster, and even higher on dedicated machines.


Scan-based queries can be executed at interactive speeds on disk-resident datasets of up to a trillion records.


Near-linear scalability in the number of columns and servers is achievable for systems containing thousands of nodes.


MR can benefit from columnar storage just like a DBMS.


Extreme-scale parallel DBMSs may benefit from the serving tree architecture just like search engines.


Record assembly and parsing are expensive. Software layers (beyond the query processing layer) need to be optimized to directly consume column-oriented data.


MR and query processing can be used in a complemen- tary fashion; one layer’s output can feed another’s input.


In a multiuser environment, a larger system can benefit from economies of scale while offering a qualitatively better user experience.


The bulk of a Web-scale dataset can be scanned fast. Getting to the last few percent within tight time bounds is hard.


Dremel’s codebase is dense; it comprises fewer than 100K lines of C++, Java, and Python code. The first version was built by Andrey Gubarev as a 20% project.


Like MR, Dremel provides fault- tolerant execution, a flexible data model, and in situ data processing capabilities.


Our columnar representation of nested data builds on
ideas that date back several decades: separation of struc-
ture from content and transposed representation. A recent
review of work on column stores, including compression
and query processing, can be found in Abadi et al.1 Many
commercial DBMSs support storage of nested data using
XML (e.g., O’Neil et al.20
).


The data model used in Dremel is a variation of the complex value models and nested relational models dis- cussed in Abiteboul et al.2


Abadi, D.J., Boncz, P.A., Harizopoulos, S. Column-oriented database systems. VLDB 2, 2 (2009).


Abiteboul, S., Hull, R., and Vianu, V. Foundations of Databases. Addison Wesley, Reading, PA, 1995.


Process finished with exit code 0


Date
June 27, 2024