Abstract
Modern clustering tasks often involve datasets with billions of points, pushing traditional frameworks to their limits. clusterNOR (Clustering NUMA Optimized Routines) is a high-performance framework designed to maximize the potential of multi-core, multi-socket hardware. By implementing Non-Uniform Memory Access (NUMA)-aware data locality and a memory-efficient "Minimal Triangle Inequality" (MTI) pruning algorithm, clusterNOR outperforms distributed systems like Spark MLlib by up to 100x. This paper details the system and algorithmic optimizations that allow clusterNOR to process massive datasets on a single machine.
Introduction
Clustering is a fundamental tool in unsupervised machine learning, yet it faces significant scalability challenges as datasets balloon into the billions of points. Traditional frameworks often suffer from hardware obliviousness, treating memory as a flat pool and ignoring the latency penalties of NUMA architectures. Furthermore, iterative algorithms frequently hit synchronization barriers, and advanced pruning techniques often lead to excessive memory consumption. clusterNOR addresses these bottlenecks through a holistic approach that combines hardware-aware system design with streamlined algorithmic logic.
NUMA-Aware System Design
Modern high-performance servers utilize NUMA architectures, where processors access local memory significantly faster than memory attached to remote sockets. clusterNOR optimizes for this by binding threads to specific NUMA nodes and ensuring data is partitioned to reside in local RAM.
To manage execution, the framework employs a partitioned priority task queue. This structure allows for "work stealing" to balance loads, but restricts stealing to threads within the same NUMA node to prevent high-latency remote memory accesses. This design ensures that the CPU spends more time processing data and less time waiting for memory fetches.
Algorithmic Innovations
Beyond system-level optimizations, clusterNOR introduces several algorithmic improvements:
- Minimal Triangle Inequality (MTI): Traditional pruning algorithms like Elkan’s require $O(nk)$ extra memory, which is prohibitive for large datasets. MTI reduces this to $O(n)$. While it may perform more distance calculations than Elkan’s, it is faster in practice because it avoids the heavy computational overhead of maintaining complex distance bound structures.
- Semi-External Memory (SEM): For datasets exceeding physical RAM, clusterNOR utilizes SSDs. A custom "row cache" manages data at the granularity of individual points, achieving nearly 100% cache hit rates as the algorithm converges and allowing SSD-backed performance to rival in-memory speeds.
- Barrier Minimization: By merging the steps of the Majorize-Minimization (MM) pattern into a single pass, the framework significantly reduces the number of global synchronization points that typically stall multi-threaded execution.
Performance Evaluation
clusterNOR was evaluated using real-world datasets like Friendster (66M points) and massive synthetic datasets up to 2.1 billion points (1.1TB).
Key results include:
- Massive Speedups: clusterNOR achieved a 100x performance improvement over Spark MLlib and Apple Turi in k-means benchmarks.
- Efficiency and Scalability: The MTI algorithm was 2x to 5x faster than Elkan’s while using significantly less memory. The framework also demonstrated near-linear speedup as core counts increased, validating the effectiveness of its NUMA optimizations.
- Scale-Up Capability: The SEM mode successfully clustered 2.1 billion points on a single machine, a task typically reserved for large distributed clusters.
Conclusion
clusterNOR demonstrates that a well-optimized "scale-up" approach can often surpass distributed "scale-out" solutions by eliminating the "network tax" and maximizing hardware efficiency. By aligning software architecture with the realities of modern NUMA hardware, clusterNOR provides a powerful and efficient solution for large-scale clustering tasks.
Summary updated