Network volumes offer persistent storage that exists independently of the lifecycle of a Serverless worker. This means your data will be retained even if a worker is stopped or your endpoint is deleted.

Network volumes can be attached to multiple Serverless endpoints, making them ideal for sharing data, or maintaining datasets between Serverless workers.

When attached to a Serverless endpoint, a network volume is mounted at /runpod-volume within the worker environment.

If your account lacks sufficient funds to cover storage costs, your network volume may be terminated. Once terminated, the disk space is immediately freed for other users, and RunPod cannot recover lost data. Ensure your account remains funded to prevent data loss.

When to use a network volume

Consider using a network volume when your Serverless endpoints needs:

  • Persistent data that outlives individual workers: Keep your data safe and accessible even after a worker is stopped or an endpoint is scaled to zero.
  • Shareable storage: Use the same data across different workers of the same endpoint or even different endpoints. While a network volume can be attached to multiple Serverless endpoint configurations, ensure your application logic handles concurrent access appropriately if workers from different endpoints write to the volume to prevent data corruption.
  • Efficient data management: Store frequently used models or large datasets to avoid re-downloading them for each new Serverless worker, saving time, bandwidth, and reducing cold start times.
  • Stateful applications: Maintain state across multiple invocations of a Serverless function, enabling more complex, long-running tasks.

Create a network volume

To create a new network volume:

  1. Navigate to the Storage page in the RunPod console.

  2. Select New Network Volume.

  3. Configure your volume:

    • Select a datacenter for your volume. Datacenter location does not affect pricing, but the datacenter location will determine which Serverless endpoints your network volume can be used with. Your Serverless endpoint must be in the same datacenter as the network volume.
    • Provide a descriptive name for your volume (e.g., “serverless-shared-models” or “project-gamma-datasets”).
    • Specify the desired size for the volume in gigabytes (GB).

    Network volume size can be increased later, but cannot be decreased.

  4. Select Create Network Volume.

You can edit and delete your network volumes using the Storage page.

Attach a network volume to an endpoint

To enable workers on an endpoint to use a network volume:

  1. Navigate to the Serverless Endpoints page in the RunPod console.
  2. Either create a New Endpoint or select an existing endpoint and choose Edit Endpoint from the options menu (three dots).
  3. In the endpoint configuration, expand the Advanced section.
  4. From the Network Volume dropdown, select the network volume you want to attach to the endpoint.
  5. Configure any other fields as you normally would, then select Save Endpoint (or Deploy for a new endpoint).

Data from the network volume will be accessible to all workers for that endpoint from the /runpod-volume directory. Use this path to read and write shared data in your handler function.

Multiple workers cannot write to a single network volume simultaneously.

Architecture details

Network volumes are backed by high-performance storage servers co-located with RunPod GPU servers. These are connected via high-speed networks and use NVMe SSDs for optimal performance, but data transfer speeds can vary widely based on location and network conditions (200-400MB/s, up to 10GB/s).

Potential benefits

Using network volumes with Serverless provides significant flexibility and can lead to improved performance and cost savings:

  • Reduced cold starts: By storing large models or datasets on a network volume, workers can access them quickly without needing to download them on each cold start.
  • Cost efficiency: Network volume storage space costs less than frequently re-downloading large files or relying solely on container storage for data that needs to persist.
  • Simplified data management: Centralize your datasets and models for easier updates and management across multiple Serverless workers and endpoints.