SKEG · REFERENCE

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:

  1. Built-in defaults.
  2. The optional YAML or TOML file selected by --config or SKEG_CONFIG.
  3. skeg.auto.json in the resolved data directory, if present.
  4. Environment variables.
  5. 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:

ProfileGraphTurboQuant codesShared query cache
latency (default)HeapHeap64 MiB
balancedMappedHeap16 MiB
capacityMappedMapped4 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_fraction sets 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_bytes sets 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_ms sets how long a connection waits for room before Skeg refuses its frame. The default is 500 ms. Zero refuses immediately.

Search and maintenance

SettingDefaultWhat it controls
search.deadline_ms30,000 msDeadline for collecting shard replies to a vector search. Use a positive value in milliseconds.
search.speed_window5Expansions without a change in the top results before early termination when search.speed is enabled.
search.payload_read_slots8Concurrent payload reads across the process. Accepts 1 through 1024.
maintenance.idle_interval_ms10,000 msHow often each shard checks for maintenance work while idle.
maintenance.fold_concurrency2Concurrent folds across the process. A CONSOLIDATE can request work on multiple shards. Folds wait for a free slot.
maintenance.consolidate_threadsautoThread 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_garbage0.25Fraction 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_fds is the file-descriptor limit Skeg tries to raise toward at startup. The default is 65,536, subject to operating-system limits.
  • observability.trace_otlp_endpoint enables OTLP/gRPC export to an HTTP or HTTPS collector. An endpoint requires a build with tracing-otlp. In the configuration file, use an endpoint without credentials, query parameters or a fragment.
  • observability.trace_sample_rate sets the fraction of traces sampled, from 0 to 1, default 1. observability.trace_resource_attrs adds text attributes to the exported traces. In YAML and TOML use a table of strings. The short environment alias accepts comma-separated key=value pairs.

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 keyFlagEnvironment aliasDetails
server.protocol--protocolSKEG_PROTOCOLskeg --help
server.addr--addrSKEG_ADDR (SKEG_RESP3_ADDR under resp3)skeg --help
server.data_dir--data-dirSKEG_DATA_DIRskeg --help
server.mode--modeSKEG_MODEskeg --help
server.shards.count-SKEG_SHARDS (or SKEG_SERVER__SHARDS__COUNT)auto (the performance-core count) or 1 to 32; see Shards
server.workers--workersSKEG_WORKERSskeg --help
server.max_connections--max-connectionsSKEG_MAX_CONNECTIONSObservability
server.max_fds-SKEG_MAX_FDSFile descriptors
server.shutdown_timeout_ms-SKEG_SHUTDOWN_TIMEOUT_MSMetrics, memory and shutdown
auth.tenant_auth--tenant-authSKEG_TENANT_AUTHAuthentication
auth.tenant_strict--tenant-strictSKEG_TENANT_STRICTAuthentication
auth.admin_tenant--admin-tenantSKEG_ADMIN_TENANTAuthentication
auth.admin_channel--admin-channelSKEG_ADMIN_CHANNELskeg --help
auth.pre_auth_deadline_ms--pre-auth-deadline-msschema form onlylogin deadline, 100 to 600000, 10000
auth.password_waiters--password-waitersschema form onlylogins waiting for a password check, 1 to 4096, 64
auth.password_waiters_per_source--password-waiters-per-sourceschema form onlythe same, per client address, 1 to 4096; default the smaller of 4 and password_waiters
auth.password_wait_ms--password-wait-msschema form onlyhow 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-connectionsschema form onlyconnections not yet signed in; default half of max_connections
listener.pre_auth_connections_per_source--pre-auth-connections-per-sourceschema form onlythe same, per client address; default the smaller of 16 and pre_auth_connections
storage.tier_mmap--tier-mmapSKEG_TIER_MMAPskeg --help
storage.graph_mmap--graph-mmapSKEG_GRAPH_MMAPskeg --help
memory.profile--memory-profileSKEG_MEMORY_PROFILEMemory profiles and ingress
memory.query_cache_bytes--query-cache-bytesSKEG_QUERY_CACHE_BYTES (SKEG_RERANK_CACHE_MB, in MiB)Memory profiles and ingress
memory.limit_bytes-SKEG_MEMORY_LIMIT_BYTESMemory and shutdown
memory.reserve_bytes-SKEG_MEMORY_RESERVE_BYTESMemory and shutdown
memory.ingress_fraction-SKEG_INGRESS_FRACTIONMemory profiles and ingress
memory.ingress_budget_bytes-SKEG_INGRESS_BUDGET_BYTESMemory profiles and ingress
memory.ingress_stall_ms-SKEG_INGRESS_STALL_MSMemory profiles and ingress
search.speed--speedSKEG_SPEEDskeg --help
search.payload_read_slots--payload-read-slotsschema form onlySearch and maintenance
search.deadline_ms-SKEG_VSEARCH_DEADLINE_MSSearch and maintenance
search.speed_window-SKEG_SPEED_WINDOWSearch and maintenance
maintenance.idle_interval_ms-SKEG_IDLE_MAINT_MSSearch and maintenance
maintenance.fold_concurrency-SKEG_FOLD_CONCURRENCYSearch and maintenance
maintenance.consolidate_threads-SKEG_CONSOLIDATE_THREADSSearch and maintenance
maintenance.vacuum_garbage-SKEG_VACUUM_GARBAGESearch and maintenance
observability.metrics_port--metrics-portSKEG_METRICS_PORTObservability
observability.trace_otlp_endpoint-SKEG_TRACE_OTLP_ENDPOINTTracing
observability.trace_sample_rate-SKEG_TRACE_SAMPLE_RATETracing
observability.trace_resource_attrs-SKEG_TRACE_RESOURCE_ATTRSTracing