Server Configuration

Configure Torque with CLI arguments, environment variables, or a TOML config file. Settings resolve in order: CLI args > environment variables > TOML file > defaults.

CLI Arguments

ArgumentDefaultDescription
--api-keyautoBootstrap API key (auto-generated with tq_ prefix if omitted)
--api-addr0.0.0.0:8108HTTP API listen address
--ingest-addr0.0.0.0:8109TCP ingest listen address
--data-dir./dataDirectory for persisted data (collections, indexes, keys)
--log-levelinfoLog level: trace, debug, info, warn, error
--cors-origins*CORS allowed origins (comma-separated)
--configPath to TOML config file
--license-keyTruespar license key
--api-basehttps://api.truespar.comTruespar API base URL for license check-in
--studio-dirPath to pre-built Studio dist directory (overrides embedded files)
--log-dirDirectory for daily rolling log files (e.g., torque.log.2026-03-13). When set, logs to both stdout and file.
--slow-query-ms0Slow query logging threshold in milliseconds. Queries exceeding this are logged at WARN. 0 = disabled.
--tls-certTLS certificate file path (PEM format). Requires --features tls at build time.
--tls-keyTLS private key file path (PEM format). Requires --features tls at build time.
--allow-drop-collectiontrueAllow deleting collections via API. Disable with TORQUE_ALLOW_DROP_COLLECTION=false.
--no-studioDisable the embedded Studio web UI. Re-enable with TORQUE_STUDIO_ENABLED=true.
--allowed-ipsHTTP API IP allowlist (comma-separated). Empty = allow all.

Memory Configuration

ArgumentDefaultDescription
--max-memory-percent90Maximum memory usage as percentage of system RAM
--max-memory-bytesMaximum memory in bytes (overrides percent)
--max-http-body-bytesunlimitedMaximum HTTP request body size in bytes (unlimited for TQBF uploads)
--max-vector-memory-gb16Maximum vector index memory in GB
--max-ingest-connections64Maximum concurrent TCP ingest connections
--query-timeout-ms10000Query timeout in milliseconds

GPU Configuration

ArgumentDefaultDescription
--gpu-vram-budget-mb0 (auto)GPU VRAM budget for dense bitmaps in MB. 0 auto-detects 50% of device VRAM.

GPU acceleration is enabled automatically when a CUDA-capable NVIDIA GPU is detected. If no GPU is available, Torque falls back to CPU with no configuration change required.

Compaction

ArgumentDefaultDescription
--compaction-interval-secs1800 (30 min)Automatic compaction interval. 0 to disable.
--compaction-memory-threshold-percent80Trigger compaction when memory usage exceeds this percent of max. 0 to disable.
--overlay-flush-interval-ms1000Overlay persistence flush interval in milliseconds (realtime mode).

Environment Variables

Every configuration option has a corresponding environment variable with the TORQUE_ prefix:

Environment VariableEquivalent CLI Argument
TORQUE_API_KEY--api-key
TORQUE_API_ADDR--api-addr
TORQUE_INGEST_ADDR--ingest-addr
TORQUE_DATA_DIR--data-dir
TORQUE_LOG_LEVEL--log-level
TORQUE_CORS_ORIGINS--cors-origins
TORQUE_INGEST_ALLOWTOML only: ingest_allow
TORQUE_GPU_VRAM_BUDGET_MB--gpu-vram-budget-mb
TORQUE_MAX_VECTOR_MEMORY_GB--max-vector-memory-gb
TORQUE_MAX_HTTP_BODY_BYTES--max-http-body-bytes
TORQUE_MAX_MEMORY_PERCENT--max-memory-percent
TORQUE_MAX_MEMORY_BYTES--max-memory-bytes
TORQUE_MAX_INGEST_CONNECTIONS--max-ingest-connections
TORQUE_QUERY_TIMEOUT_MS--query-timeout-ms
TORQUE_LICENSE_KEY--license-key
TORQUE_API_BASE--api-base
TORQUE_STUDIO_DIR--studio-dir
TORQUE_OVERLAY_FLUSH_INTERVAL_MS--overlay-flush-interval-ms
TORQUE_COMPACTION_INTERVAL_SECS--compaction-interval-secs
TORQUE_COMPACTION_MEMORY_THRESHOLD_PERCENT--compaction-memory-threshold-percent
TORQUE_LOG_DIR--log-dir
TORQUE_SLOW_QUERY_MS--slow-query-ms
TORQUE_TLS_CERT--tls-cert
TORQUE_TLS_KEY--tls-key
TORQUE_ALLOW_DROP_COLLECTION--allow-drop-collection
TORQUE_STUDIO_ENABLED--no-studio (inverse)
TORQUE_ALLOWED_IPS--allowed-ips

TOML Configuration File

Create a torque.toml file in the working directory (auto-detected) or specify the path with --config:

# torque.toml
api_key = "your-api-key"
api_addr = "0.0.0.0:8108"
ingest_addr = "0.0.0.0:8109"
data_dir = "./data"
log_level = "info"

# CORS
cors_origins = ["https://app.example.com", "http://localhost:3000"]

# TCP ingest allowlist (empty = allow all)
ingest_allow = ["10.0.0.0/8", "192.168.1.0/24"]

# Memory
max_memory_percent = 90
# max_http_body_bytes = 134217728  # default: unlimited
max_vector_memory_gb = 16
max_ingest_connections = 64
query_timeout_ms = 10000

# GPU
gpu_vram_budget_mb = 0

# Compaction
compaction_interval_secs = 1800
compaction_memory_threshold_percent = 80
overlay_flush_interval_ms = 1000

# License
license_key = "tskey_..."
api_base = "https://api.truespar.com"

# TLS (requires --features tls build)
# tls_cert = "/etc/torque/cert.pem"
# tls_key = "/etc/torque/key.pem"

# Logging
# log_dir = "/var/log/torque"
# slow_query_ms = 100

TLS / HTTPS

Torque supports TLS encryption for the HTTP API:

# Start with TLS
torque-server --api-key KEY --tls-cert /path/to/cert.pem --tls-key /path/to/key.pem

When TLS is enabled, Studio and all API endpoints are served over HTTPS. The TCP ingest port does not use TLS.

Windows Service

On Windows, Torque can be installed and run as a Windows Service:

# Install the service (uses current CLI arguments)
torque-server --service-install --api-key YOUR_API_KEY --data-dir C:\torque\data

# Uninstall the service
torque-server --service-uninstall

Once installed, the service can be managed through the Windows Services manager (services.msc) or the command line:

# Start the service
net start TorqueServer

# Stop the service
net stop TorqueServer

Ports

Torque uses two ports by default:

PortProtocolDescription
8108HTTPSearch API, document CRUD, collection management, Studio
8109TCPBinary ingest protocol (batch and realtime document streaming)

Persistence

Torque persists data to the data_dir directory automatically. On restart, collections, indexes, aliases, API keys, synonyms, presets, and stopwords are restored from disk. No re-ingestion is required.

Persistence is enabled by default. The data directory contains:

  • Collection schemas and metadata
  • Compressed binary index data (per collection)
  • Alias mappings
  • API keys, synonym sets, presets, and stopword sets
  • Realtime overlay data (for collections in realtime ingest mode)

Configuration Priority

When the same setting is specified in multiple places, higher-priority sources override lower ones:

  1. CLI arguments (highest priority)
  2. Environment variables
  3. TOML config file
  4. Built-in defaults (lowest priority)