Skip to main content
The /data filesystem on fal is a distributed, parallel storage system. It performs best when multiple files are read concurrently. Sequential file reads β€” loading one weight file at a time β€” significantly underutilize the filesystem and result in slower cold starts.

The Problem

Most model loading libraries (HuggingFace, PyTorch) read weight files sequentially β€” one shard at a time. On a distributed filesystem, this leaves most of the available bandwidth idle:

The Solution: Pre-Read Files in Parallel

Before loading your model, pre-read all weight files into the OS page cache using parallel I/O. When the model loader then reads the files, they’re already cached in memory and load instantly.
This reads up to 32 files simultaneously, pulling them into the page cache. The subsequent from_pretrained() call then reads from cache instead of the network.

Using It in Your App

Add the pre-read step at the beginning of your setup() method, before model loading:

Python Helper

For a cleaner approach, wrap it in a function:

When to Use This

How It Works

fal’s /data is a distributed filesystem that can serve many files concurrently at high throughput. When you read files sequentially, you use only a fraction of the available bandwidth. The xargs -P 32 approach fires off 32 concurrent cat commands, each reading a different file. The OS caches the file contents in memory (page cache), so when your model loader reads the same files moments later, it reads from RAM instead of the network.
Adjust the parallelism (-P 32) based on your model. For models with many small files (e.g., 100+ safetensors shards), higher parallelism helps. For models with a few large files, lower parallelism (8-16) is sufficient.

Comparison with FlashPack

Both techniques can be combined β€” use parallel pre-reading as a quick improvement, then migrate to FlashPack for even faster loading.

FlashPack

High-throughput tensor loading at up to 25 Gbps

Persistent Storage

How /data works and caching behavior