Storage Backends

Learn how to configure different storage backends in τ.

τ provides two primary storage backends, each tailored for different use cases. You can configure the desired backend using environment variables when starting the server.

Overview

The storage backend determines how and where your data is stored. τ supports both in-memory and file-based persistent storage.

  • InMemory: A volatile, high-performance backend where all data is stored in memory.
  • File: A persistent backend that writes data to disk, ensuring durability across server restarts.

By default, the server uses the InMemory backend if no configuration is specified.

InMemory Backend

The InMemory backend is the default and simplest way to run τ. It offers the highest performance since all data lives in RAM, eliminating disk I/O overhead. However, it is volatile, meaning all data is lost when the server process terminates.

This backend is ideal for:

  • Development and testing
  • Temporary data processing
  • Caching scenarios where data persistence is not required

Usage

To use the InMemory backend, simply run the server without any specific backend configuration:

Terminal
1zig build run-server

You can also explicitly set the TAU_BACKEND_TYPE environment variable:

Terminal

File Backend

The File backend provides persistent storage by writing data to files on disk. It uses a Write-Ahead Log (WAL) to ensure data integrity and durability. All mutations are first appended to the log before being applied to the main data file, guaranteeing that no data is lost even in the event of a crash.

This backend is recommended for production environments or any use case where data must be preserved.

Usage

To use the File backend, set the TAU_BACKEND_TYPE environment variable to File. You must also specify a directory for the data files using TAU_DATA_DIR.

Terminal
1# Create a directory for your data
2mkdir -p /path/to/data
3
4# Run the server with the File backend
5TAU_BACKEND_TYPE=File TAU_DATA_DIR=/path/to/data zig build run-server

If the specified data directory does not exist, the server will attempt to create it.

When using the File backend, you will see .wal and .db files appear in your data directory as you interact with the database.

Last updated: 2/1/2026