Ray: A Distributed Framework for Emerging AI Applications

Philipp Moritz, Robert Nishihara, Stephanie Wang, Alexey Tumanov, Richard Liaw, Eric Liang, Melih Elibol, Zongheng Yang, William Paul, Michael I. Jordan, Ion Stoica · OpenReview

Introduction

Ray is a high-performance distributed framework designed to unify the three distinct phases of reinforcement learning (RL): simulation, training, and serving. By combining a "bottom-up" distributed scheduler with a centralized Global Control Store (GCS), Ray scales to over 1.8 million tasks per second, outperforming specialized systems while maintaining a simple Python-based API.

The Challenge of Reinforcement Learning

The next generation of AI applications, particularly Reinforcement Learning, imposes requirements that existing distributed systems cannot meet. Unlike classical supervised learning, which operates on massive static batches, RL requires an agent to interact dynamically with an environment.

The reinforcement learning loop: simulation, training, and serving.

This workflow involves three distinct workloads:

  • Simulation: Generating data through environment interaction, often requiring millisecond-level tasks.
  • Training: Improving the policy using deep learning frameworks.
  • Serving: Acting on the policy in real-time.

Existing systems struggle to bridge these gaps. Batch systems like Spark have too much overhead for fine-grained simulations. Deep learning frameworks like TensorFlow lack native support for dynamic, nested control flows. Actor frameworks like Akka handle state well but often struggle with recovery and fine-grained task distribution. Ray aims to provide a single system that handles all three workloads with high throughput and low latency.

System Architecture

Ray introduces a unique architecture that separates the control plane from the data plane to achieve massive scalability.

Ray's distributed architecture featuring the Global Control Store (GCS) and bottom-up scheduling.

1. Global Control Store (GCS)

The GCS is Ray's core innovation. Instead of a central scheduler tracking all metadata, Ray stores lineage and object locations in a sharded, replicated key-value store. This design makes system components stateless, facilitating easier recovery and scaling.

2. Bottom-Up Distributed Scheduler

To handle millions of tasks, Ray employs a two-level hierarchical scheduler. Tasks are first submitted to a local scheduler on the node. If the node is overloaded, the task is pushed to a global scheduler. This prevents the central bottleneck common in traditional distributed systems.

3. Programming Model: Tasks and Actors

Ray provides a unified interface for Tasks (stateless, fine-grained functions) and Actors (stateful, long-running classes). This allows developers to write standard Python code that executes seamlessly across a cluster.

4. Distributed Object Store

Ray utilizes shared memory (via Apache Arrow) on each node to allow "zero-copy" data sharing between tasks on the same machine. This is critical for performance when passing large neural network weights between training and serving components.

Performance and Results

Ray's evaluation focuses on its ability to handle high-throughput RL workloads and its scalability compared to specialized systems.

  • Scalability: Ray demonstrated near-linear scaling, reaching 1.8 million tasks per second on a 100-node cluster.
  • RL Benchmarks: Using the Evolution Strategies (ES) algorithm, Ray scaled to 8,192 cores and solved the Humanoid task in 3.7 minutes—more than twice as fast as previous specialized systems.
  • Fault Tolerance: The GCS-based architecture allows Ray to track the "lineage" of every object. If a node fails, Ray re-runs only the necessary tasks to recreate lost data, resulting in recovery delays under 30ms.

Conclusion

Ray successfully unifies simulation, training, and serving into a single distributed framework. By moving system state to a centralized GCS and utilizing a bottom-up scheduler, Ray achieves the performance required for the next generation of AI applications without sacrificing the simplicity of a Pythonic API. Future work includes optimizing GCS storage costs and improving scheduling decisions through runtime profiling.

Summary updated

BibTeX
@misc{moritz2017ray,
  author = {Philipp Moritz and Robert Nishihara and Stephanie Wang and Alexey Tumanov and Richard Liaw and Eric Liang and Melih Elibol and Zongheng Yang and William Paul and Michael I. Jordan and Ion Stoica},
  title = {{Ray: A Distributed Framework for Emerging AI Applications}},
  year = {2017},
  eprint = {1712.05889},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1712.05889},
}
Figure