Skip to main content

Distributed peer cache for ML training data — works with any framework on any S3-compatible store

Project description

RAMJET — Distributed peer cache for ML training data

Python PyPI License

RAMJET is a peer-to-peer cache between any ML training job and any S3-compatible object store. The first run pulls data from S3 once and seeds the cluster; subsequent runs across the team serve every sample peer-to-peer with zero S3 calls.

Works with any framework that loads data from S3/HTTP/local paths — PyTorch, TensorFlow, JAX, HuggingFace Datasets, Ultralytics, custom loaders — and any DDP launcher (torchrun, DeepSpeed, Accelerate, SLURM).

Measured on a real 2× A5000 cluster (5315 samples, 5 epochs): 6.5× faster export when cache is warm, zero S3 requests after the first run.

Why RAMJET?

Problem Solution
Repeated S3 pulls across team experiments One pull seeds the cluster; the rest serve peer-to-peer
Network bottleneck from shared object storage Local SSD cache on every training node
No visibility into data-loading bottlenecks Live dashboard with per-node bytes-by-source split (local / peer / S3) and Grafana-native Prometheus metrics
Multi-node DDP coordination Auto-detect rank/world size from torchrun/SLURM env

Quick Start

1. Install

pip install ramjetio

2. Add to Your Training Script

import ramjetio
from torch.utils.data import DataLoader

ramjetio.init()

dataset = ramjetio.CachedDataset(your_dataset)
loader = DataLoader(dataset, batch_size=32)

for batch in loader:
    train_step(batch)

3. Run

Get your API key from app.ramjet.io (create a cluster → copy key).

export RAMJET_API_KEY="your_api_key_here"
python train.py

Multi-GPU: torchrun --nproc_per_node=N train.py

That's it! Your nodes will appear in the dashboard within seconds.

How It Works

   ┌──────────┐   ┌──────────┐   ┌──────────┐
   │  Node 0  │   │  Node 1  │   │  Node 2  │
   │  train   │   │  train   │   │  train   │
   │    │     │   │    │     │   │    │     │
   │    ▼     │   │    ▼     │   │    ▼     │
   │ ramjetio │◄─►│ ramjetio │◄─►│ ramjetio │
   │  cache   │   │  cache   │   │  cache   │
   │ NVMe SSD │   │ NVMe SSD │   │ NVMe SSD │
   └─────┬────┘   └─────┬────┘   └─────┬────┘
         └──────────────┼──────────────┘
                        ▼
                ┌───────────────┐
                │ S3 / MinIO /  │
                │ R2 / GCS / …  │
                └───────────────┘

   Hits stay local or hop to a peer (sub-ms over LAN).
   Only the first miss in the cluster ever touches object storage.

Features

  • 🚀 Zero-config cachingramjetio.init() handles everything
  • 📊 Real-time dashboard — monitor cache hits, throughput, GPU utilization
  • 🔄 Consistent hashing — data distributed evenly across nodes
  • 💾 Disk-backed cache — survives restarts, uses NVMe SSDs efficiently
  • 🔌 Works with any setup — torchrun, DeepSpeed, Accelerate, custom launchers
  • ☁️ S3/MinIO integration — configure data source in dashboard, not in code

Integration Examples

Runnable scripts in examples/:

See docs/INTEGRATION.md for deeper walkthroughs.

Configuration

Environment Variables

Variable Description Default
RAMJET_API_KEY Your API key (required)
RAMJET_CACHE_PATH Local cache directory /tmp/ramjet_cache
RAMJET_CACHE_SIZE Max cache size 100GB
RAMJET_PORT Cache server port 9000

Dashboard Settings

Configure in the web dashboard (no code changes needed):

  • Data Source: S3/MinIO endpoint, bucket, credentials
  • Cache Settings: TTL, replication factor, eviction policy

Distributed Training (DDP)

RAMJET automatically detects torchrun and DDP environments:

Single Machine, Multiple GPUs (torchrun)

# 4 GPUs on one machine
torchrun --nproc_per_node=4 train.py
import ramjetio
import torch.distributed as dist

# Only LOCAL_RANK=0 starts cache server - others wait and share it
ramjetio.init()

# All ranks use the same cache
dataset = ramjetio.CachedDataset(your_dataset)

Multi-Node Training

RAMJET auto-detects your cluster manager — no manual configuration needed:

Environment How to launch RAMJET detects it?
SLURM srun python train.py ✅ Automatic
Kubernetes (PyTorchJob) Managed by operator ✅ Automatic
DeepSpeed deepspeed --hostfile hosts train.py ✅ Automatic
Accelerate accelerate launch train.py ✅ Automatic
torchrun torchrun --nproc_per_node=N train.py ✅ Automatic
SageMaker Configured in SageMaker console ✅ Automatic

Each node runs one cache server (on LOCAL_RANK=0), and all nodes share data via consistent hashing. RAMJET reads LOCAL_RANK, RANK, WORLD_SIZE from environment — every major launcher sets these automatically.

CLI Tools

# Start cache server manually (usually not needed — ramjetio.init() does this)
ramjetio-server --port 9000 --capacity 100GB

# Check cache status
ramjetio-client stats

# Clear cache
ramjetio-client clear

Requirements

  • Python 3.8+
  • PyTorch 1.9+
  • Linux (recommended for production)
  • SSD storage for cache (recommended)

Documentation

License

PolyForm Noncommercial License 1.0.0 — free for personal and non-commercial use. For commercial licensing, contact licensing@ramjet.dev. See LICENSE for details.

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ramjetio-0.9.2.tar.gz (198.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ramjetio-0.9.2-py3-none-any.whl (123.9 kB view details)

Uploaded Python 3

File details

Details for the file ramjetio-0.9.2.tar.gz.

File metadata

  • Download URL: ramjetio-0.9.2.tar.gz
  • Upload date:
  • Size: 198.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ramjetio-0.9.2.tar.gz
Algorithm Hash digest
SHA256 ab38d37a97cf75265de5bea6eb1b79d7b043389201a3ca922f52a8fb7948e5cd
MD5 685295591316e98e64cbd949a2ad3391
BLAKE2b-256 7c8d845b87a24d6df00c2f69cf134147951a5fd1c2f38a7e95476d47a460c8de

See more details on using hashes here.

File details

Details for the file ramjetio-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: ramjetio-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 123.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ramjetio-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b02f14efc436db7ed0abff4dcb12b6c29f5bcdabf7f3f917d3076a3a8d5774d7
MD5 d698cd552b2e31a3a0d90d775cf77436
BLAKE2b-256 3e736fe92a02d1a1e7dbce72ff5de1e065f2cf8b5d904ea5f8dae8c8d623dc96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page