Abstract
Persistent partitioning is effective in avoiding expensive shuffling operations. However, it remains a significant challenge to automate this process for Big Data analytics workloads that extensively use user-defined functions (UDFs), where sub-computations are hard to be reused for partitionings compared to relational applications. In addition, functional dependency that is widely utilized for partitioning selection is often unavailable in the unstructured data that is ubiquitous in UDF-centric analytics. We propose the Lachesis system, which represents UDF-centric workloads as workflows of analyzable and reusable sub-computations. Lachesis further adopts a deep reinforcement learning model to infer which sub-computations should be used to partition the underlying data. This analysis is then applied to automatically optimize the storage of the data across applications to improve performance and users' productivity.
Introduction: The Shuffling Bottleneck
In the world of Big Data, "shuffling"—the process of moving massive amounts of data across a network between machines—is the ultimate performance killer. To avoid this, engineers use partitioning: organizing data so that related pieces live on the same machine. While traditional relational databases (SQL) have automated this for decades using clear schemas and foreign keys, modern analytics has a blind spot: User Defined Functions (UDFs).
UDFs allow developers to write complex logic in languages like Python or C++ to process unstructured data (like nested JSON). To a database optimizer, these functions are often "black boxes." Because the system cannot see inside the UDF to understand how it accesses data, it cannot automate partitioning effectively.
The Lachesis Approach
Lachesis is a new system that peeks inside the box, representing UDF logic as analyzable graphs and using Deep Reinforcement Learning (DRL) to choose the perfect partitioning strategy. It shifts the paradigm from traditional relational analysis to a graph-based workflow analysis.
As illustrated in the comparison above, Lachesis replaces foreign key analysis with historical IR graph analysis and substitutes traditional cost estimation with a DRL-based selector that learns from historical latency rewards.
Core Components
1. Intermediate Representation (IR) Graphs
Instead of treating a UDF as a black box, Lachesis translates the code into a "two-terminal" Directed Acyclic Graph (DAG). This turns abstract procedural code into a searchable map of data flows, identifying how specific attributes (like a JSON key) are derived and used.
2. Deep Reinforcement Learning (DRL)
Since there is no reliable mathematical formula for UDF costs, Lachesis uses an A3C (Asynchronous Advantage Actor-Critic) model. The model examines features such as dataset size, access frequency, and UDF complexity to "learn" which partitioning strategy (Hash, Range, etc.) will minimize future latency. This allows the system to bypass the need for human-designed cost models.
3. Subgraph Isomorphism for Matching
When a new query arrives, Lachesis uses graph matching to see if the data is already partitioned in a way that the query can exploit. This proactive approach ensures that the data is correctly laid out at the moment of storage, rather than re-partitioning reactively during query execution.
Evaluation and Results
Lachesis was evaluated using diverse workloads, including Reddit data integration (140GB+), refactored TPC-H benchmarks, and PageRank. The results demonstrate significant performance improvements:
- Speedups: It achieved a 2.4x speedup on Reddit data joins and a 6.5x speedup on PageRank compared to default partitioning.
- Outperforming Commercial Tools: In TPC-H tests, Lachesis outperformed the physical design advisors of commercial databases by 6% to 12%, proving that relational cost models fail when UDFs are involved.
- Low Overhead: The online cost of choosing a partitioner is less than a second, and the offline analysis of massive historical traces takes only minutes.
Conclusion
Lachesis proves that even the most "opaque" parts of modern data stacks can be optimized by treating them as analyzable graphs rather than black boxes. By combining IR graph analysis with reinforcement learning, Lachesis automates a previously manual and error-prone task, significantly improving both performance and developer productivity in UDF-centric environments.
Summary updated