NUMA-optimized In-memory and Semi-external-memory Parameterized Clustering

Disa Mhembere, Da Zheng, Joshua T. Vogelstein, Carey E. Priebe, Randal C. BurnsarXiv 2016

Introduction

The explosion of "Big Data" has made k-means clustering one of the most critical yet computationally demanding machine learning algorithms. While many modern libraries focus on "scaling out" by distributing tasks across networked clusters, this approach often overlooks the potential of "scaling up"—fully exploiting the sophisticated hardware within a single high-end server. The knor (k-means NUMA Optimized Routine) library addresses this gap by re-engineering k-means for modern Non-Uniform Memory Access (NUMA) architectures.

The Bottlenecks of Modern k-means

Standard k-means implementations face three primary hurdles when scaling to billions of points:

  1. Synchronization Overheads: Traditional Lloyd’s algorithm requires global barriers between distance calculations and centroid updates, limiting parallel efficiency.
  2. Memory Latency: In NUMA systems, processors access local memory significantly faster than remote memory. "NUMA-oblivious" software suffers from high latency due to frequent remote memory accesses.
  3. Pruning Memory Footprint: Efficient pruning methods like Elkan’s algorithm require $O(nk)$ extra memory, which becomes prohibitive for massive datasets ($n$) and many clusters ($k$).

The knor Architecture

The authors introduce three modules: knori (in-memory), knord (distributed), and knors (semi-external memory using SSDs). These modules leverage several key innovations:

  • Parallel Lloyd’s Algorithm: By providing each thread with a local copy of centroids for the next iteration, knor merges the two phases of k-means into a single "super-phase," eliminating synchronization barriers and enabling lock-free updates.
  • Minimal Triangle Inequality (MTI): A memory-efficient pruning technique that stores only an $O(n)$ upper bound for each point, providing substantial speedups with minimal memory overhead.
  • NUMA-Aware Scheduling: Threads are pinned to specific NUMA nodes, and data is partitioned to ensure that processors primarily work with local memory.
NUMA-aware data partitioning and thread binding ensures high data locality and minimizes remote memory access latency.
  • Partitioned Row Cache: For datasets exceeding RAM, knors utilizes SSDs with a "lazy-update" row cache. This pins frequently accessed points in memory, reducing I/O as the algorithm converges.

Evaluation and Datasets

The library was tested on real-world datasets like Friendster (66 million points) and massive synthetic benchmarks (up to 2.1 billion points, totaling 1.1 TB). These tests demonstrated knor's ability to handle datasets far exceeding physical RAM on a single machine.

Key Results

The optimizations in knor lead to dramatic performance improvements:

  • NUMA Efficiency: knori achieves nearly 6x the speed of NUMA-oblivious implementations on the same hardware.
  • Competitive Benchmarking: knor outperforms established frameworks like Spark MLlib, H2O, and Turi by more than an order of magnitude on large-scale datasets.
  • Scalability: knors successfully clustered 1.1 TB of data on a single node, where other frameworks typically failed.
Relative performance scaling of knori compared to a NUMA-oblivious implementation and the theoretical linear ideal.

Conclusion

The success of knor suggests that a single, well-optimized NUMA node can often outperform a large cluster of inefficiently utilized machines, offering a more cost-effective and power-efficient solution for massive-scale clustering. Future work aims to extend this NUMA-optimized framework to other algorithms like Gaussian Mixture Models and K-Nearest Neighbors.

Source: knor: A NUMA-Optimized In-Memory, Distributed and Semi-External-Memory k-means Library (HPDC '17)

Summary updated

BibTeX
@misc{mhembere2016numa,
  author = {Disa Mhembere and Da Zheng and Joshua T. Vogelstein and Carey E. Priebe and Randal C. Burns},
  title = {{NUMA-optimized In-memory and Semi-external-memory Parameterized Clustering}},
  year = {2016},
  eprint = {1606.08905},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.08905},
}
Figure