Server configuration
Configure a server with YAML or TOML, check the effective settings and preserve the shard layout.
Skeg 0.8 · Development documentation
Use a YAML or TOML file to keep a server’s startup settings together. The examples below create a local writable store on port 6380. Use Skeg 0.8, an unused port and a directory you can write to. For a network service, see deployment and authentication and tenants.
Write a configuration file
Copy the example below or download skeg.yaml.
Set data_dir to a new directory if you already have a store at ./data.
version: 1
server:
addr: "127.0.0.1:6380"
data_dir: "./data"
shards:
count: 1
For TOML, copy the equivalent example or download skeg.toml.
version = 1
[server]
addr = "127.0.0.1:6380"
data_dir = "./data"
[server.shards]
count = 1
Use version: 1 in YAML or version = 1 in TOML. Use nested mappings or
tables for settings. Relative data paths are resolved from the server’s
working directory. Run the check and the server from the same directory,
or use an absolute data path.
Check the settings before starting
Run the check with the same working directory, environment and overrides
you plan to use for the server. Use skeg.toml instead if you chose TOML.
skeg config check --config skeg.yaml
skeg config show --config skeg.yaml --sources server.addr server.data_dir server.shards.count
The check prints valid and exits with status 0 on success. It exits with
status 2 and reports the error if the configuration is refused. Use
--format json with either command for machine-readable output. The check
resolves the settings and checks host memory requirements without opening
the store or binding a socket. The server checks the port and the store
layout at startup.
The second command shows each selected value and its source. With the sample
file and no overrides, all three values come from the file. Omit the setting
names to inspect the full configuration. --sources includes the overridden
values. Sensitive parts of the tracing endpoint are redacted.
Start the server
Start Skeg from the same working directory you used for the check.
skeg --config skeg.yaml
The startup output shows the listening address and the number of shards it
opened. If you have redis-cli, check the listener from another terminal:
redis-cli -h 127.0.0.1 -p 6380 PING
Expect PONG. Press Ctrl+C in the server terminal to stop this foreground
example. Check your changes and restart the server to apply them.
Set a memory profile and fold limit
To map disk index graphs and run at most one fold at a time, add these sections to the example file. See memory profiles and maintenance settings for the trade-offs.
memory:
profile: balanced
maintenance:
fold_concurrency: 1
For TOML, use the equivalent sections.
[memory]
profile = "balanced"
[maintenance]
fold_concurrency = 1
Check both values before restarting. Use skeg.toml in the command if
you chose TOML.
skeg config check --config skeg.yaml
skeg config show --config skeg.yaml --sources memory.profile maintenance.fold_concurrency
Expect balanced and 1, both from the file, unless a higher-priority
source sets a different value.
Which source wins
From lowest to highest priority:
- Built-in defaults.
- The optional YAML or TOML file selected by
--configorSKEG_CONFIG. skeg.auto.jsonin the resolved data directory, if present.- Environment variables.
- Command-line flags.
Use --no-config to ignore SKEG_CONFIG. Most settings have a short
environment alias alongside the schema name. For example,
SKEG_SEARCH__DEADLINE_MS and SKEG_VSEARCH_DEADLINE_MS set the same key.
If both supply different values, startup fails. Use config show --sources
when a file edit appears to have no effect.
The auto file must be owned by the server user and have mode 0600. It
can set server.protocol, server.mode, server.workers,
storage.tier_mmap, storage.graph_mmap, search.speed and
observability.metrics_port. Skeg 0.8 reads the file when present.
For ordinary configuration, edit the YAML or TOML file.
Shards
For a new store, set server.shards.count to auto (the performance-core
count) or to an integer from 1 through 32. The environment aliases are
SKEG_SERVER__SHARDS__COUNT and SKEG_SHARDS.
A writable open must match the shard count recorded in the store. If
auto resolves differently on a new host, set the count shown in the
declares N shards error and retry. To redistribute data, build a new
store. In read-only mode (--mode serve), Skeg uses the count recorded by
the store and reports a mismatch if the requested count differs.
Metrics, memory and shutdown
Use memory.limit_bytes to cap the headroom used by the admission governor.
Use memory.reserve_bytes to set the margin it retains. Both are bytes.
The limit controls admission and the operating system enforces any process or
container memory limit. See memory and maintenance.
When enabled, observability.metrics_port serves /metrics on loopback
through a separate listener. server.shutdown_timeout_ms controls how long
connections can drain. The default is 30,000 ms. See observability
and operating Skeg for deployment details.
Memory profiles and ingress
memory.profile selects the backing for disk indexes and the default
query-cache budget:
| Profile | Graph | TurboQuant codes | Shared query cache |
|---|---|---|---|
latency (default) | Heap | Heap | 64 MiB |
balanced | Mapped | Heap | 16 MiB |
capacity | Mapped | Mapped | 4 MiB |
Explicit storage.graph_mmap, storage.tier_mmap and
memory.query_cache_bytes settings apply on top of the profile. The query
cache budget is shared by all indexes and segments in the process. Zero
disables the cache. Use SKEG.VINDEX.INFO to inspect the actual backing of
an index.
memory.ingress_fractionsets the network’s share of usable headroom as a percentage from 1 to 100. The default is 25 when headroom is known.memory.ingress_budget_bytessets an explicit ingress cap of at least 8192 bytes. Choose either the fraction or the fixed budget. Startup fails if the fixed budget exceeds the available headroom after the reserve.memory.ingress_stall_mssets how long a connection waits for room before Skeg refuses its frame. The default is 500 ms. Zero refuses immediately.
Search and maintenance
| Setting | Default | What it controls |
|---|---|---|
search.deadline_ms | 30,000 ms | Deadline for collecting shard replies to a vector search. Use a positive value in milliseconds. |
search.speed_window | 5 | Expansions without a change in the top results before early termination when search.speed is enabled. |
search.payload_read_slots | 8 | Concurrent payload reads across the process. Accepts 1 through 1024. |
maintenance.idle_interval_ms | 10,000 ms | How often each shard checks for maintenance work while idle. |
maintenance.fold_concurrency | 2 | Concurrent folds across the process. A CONSOLIDATE can request work on multiple shards. Folds wait for a free slot. |
maintenance.consolidate_threads | auto | Thread limit per rebuild while serving. auto uses a quarter of the cores, with a minimum of one. Zero removes the cap. A rebuild started during idleness can use all cores. |
maintenance.vacuum_garbage | 0.25 | Fraction of dead rows that triggers rewriting a run on its own. Accepts 0 through 1. At zero the run still needs at least 4096 dead rows. |
The fold limit controls how many rebuilds run together. The thread limit controls how much CPU each rebuild can use. Raising either can shorten maintenance at the cost of query latency while it runs.
File descriptors and tracing
server.max_fdsis the file-descriptor limit Skeg tries to raise toward at startup. The default is 65,536, subject to operating-system limits.observability.trace_otlp_endpointenables OTLP/gRPC export to an HTTP or HTTPS collector. An endpoint requires a build withtracing-otlp. In the configuration file, use an endpoint without credentials, query parameters or a fragment.observability.trace_sample_ratesets the fraction of traces sampled, from 0 to 1, default 1.observability.trace_resource_attrsadds text attributes to the exported traces. In YAML and TOML use a table of strings. The short environment alias accepts comma-separatedkey=valuepairs.
Unsupported file keys
The server rejects keys it cannot apply, including
server.shards.on_core_mismatch, filters.scan_max and search.probe.
Use skeg config show to list the settings applied by the binary.
--tier and --allow-unauthenticated-network use flags or environment
variables.
Supported file keys
The environment column gives the short alias where one exists. The schema name is formed from the uppercase key with double underscores between its parts.
| File key | Flag | Environment alias | Details |
|---|---|---|---|
server.protocol | --protocol | SKEG_PROTOCOL | skeg --help |
server.addr | --addr | SKEG_ADDR (SKEG_RESP3_ADDR under resp3) | skeg --help |
server.data_dir | --data-dir | SKEG_DATA_DIR | skeg --help |
server.mode | --mode | SKEG_MODE | skeg --help |
server.shards.count | - | SKEG_SHARDS (or SKEG_SERVER__SHARDS__COUNT) | auto (the performance-core count) or 1 to 32; see Shards |
server.workers | --workers | SKEG_WORKERS | skeg --help |
server.max_connections | --max-connections | SKEG_MAX_CONNECTIONS | Observability |
server.max_fds | - | SKEG_MAX_FDS | File descriptors |
server.shutdown_timeout_ms | - | SKEG_SHUTDOWN_TIMEOUT_MS | Metrics, memory and shutdown |
auth.tenant_auth | --tenant-auth | SKEG_TENANT_AUTH | Authentication |
auth.tenant_strict | --tenant-strict | SKEG_TENANT_STRICT | Authentication |
auth.admin_tenant | --admin-tenant | SKEG_ADMIN_TENANT | Authentication |
auth.admin_channel | --admin-channel | SKEG_ADMIN_CHANNEL | skeg --help |
auth.pre_auth_deadline_ms | --pre-auth-deadline-ms | schema form only | login deadline, 100 to 600000, 10000 |
auth.password_waiters | --password-waiters | schema form only | logins waiting for a password check, 1 to 4096, 64 |
auth.password_waiters_per_source | --password-waiters-per-source | schema form only | the same, per client address, 1 to 4096; default the smaller of 4 and password_waiters |
auth.password_wait_ms | --password-wait-ms | schema form only | how long a login waits for its check, 0 to 600000; default the smaller of 2000 and the login deadline |
listener.pre_auth_connections | --pre-auth-connections | schema form only | connections not yet signed in; default half of max_connections |
listener.pre_auth_connections_per_source | --pre-auth-connections-per-source | schema form only | the same, per client address; default the smaller of 16 and pre_auth_connections |
storage.tier_mmap | --tier-mmap | SKEG_TIER_MMAP | skeg --help |
storage.graph_mmap | --graph-mmap | SKEG_GRAPH_MMAP | skeg --help |
memory.profile | --memory-profile | SKEG_MEMORY_PROFILE | Memory profiles and ingress |
memory.query_cache_bytes | --query-cache-bytes | SKEG_QUERY_CACHE_BYTES (SKEG_RERANK_CACHE_MB, in MiB) | Memory profiles and ingress |
memory.limit_bytes | - | SKEG_MEMORY_LIMIT_BYTES | Memory and shutdown |
memory.reserve_bytes | - | SKEG_MEMORY_RESERVE_BYTES | Memory and shutdown |
memory.ingress_fraction | - | SKEG_INGRESS_FRACTION | Memory profiles and ingress |
memory.ingress_budget_bytes | - | SKEG_INGRESS_BUDGET_BYTES | Memory profiles and ingress |
memory.ingress_stall_ms | - | SKEG_INGRESS_STALL_MS | Memory profiles and ingress |
search.speed | --speed | SKEG_SPEED | skeg --help |
search.payload_read_slots | --payload-read-slots | schema form only | Search and maintenance |
search.deadline_ms | - | SKEG_VSEARCH_DEADLINE_MS | Search and maintenance |
search.speed_window | - | SKEG_SPEED_WINDOW | Search and maintenance |
maintenance.idle_interval_ms | - | SKEG_IDLE_MAINT_MS | Search and maintenance |
maintenance.fold_concurrency | - | SKEG_FOLD_CONCURRENCY | Search and maintenance |
maintenance.consolidate_threads | - | SKEG_CONSOLIDATE_THREADS | Search and maintenance |
maintenance.vacuum_garbage | - | SKEG_VACUUM_GARBAGE | Search and maintenance |
observability.metrics_port | --metrics-port | SKEG_METRICS_PORT | Observability |
observability.trace_otlp_endpoint | - | SKEG_TRACE_OTLP_ENDPOINT | Tracing |
observability.trace_sample_rate | - | SKEG_TRACE_SAMPLE_RATE | Tracing |
observability.trace_resource_attrs | - | SKEG_TRACE_RESOURCE_ATTRS | Tracing |