Athena

Configuration Options

Comprehensive reference for `config.yaml`, validation ranges, and Athena runtime environment variables.

Athena’s runtime configuration comes from four layers:

  1. config.yaml file sections such as api, gateway, backup, and postgres_clients
  2. Environment variables used directly by the runtime or interpolated into config.yaml
  3. Validation ranges inside config.yaml that clamp numeric values to safe ranges
  4. CLI flags such as --config, --pipelines, --port, and --api-only

This page is meant to be exhaustive for the main Athena server and the runtime settings wired through src/config.rs and src/config_validation.rs.

Config file discovery and precedence

Athena searches for config.yaml in this order:

  1. %APPDATA%/athena/config.yaml
  2. %LOCALAPPDATA%/athena/config.yaml
  3. %USERPROFILE%/.athena/config.yaml
  4. $XDG_CONFIG_HOME/athena/config.yaml
  5. $HOME/.config/athena/config.yaml
  6. $HOME/.athena/config.yaml
  7. ~/Library/Application Support/athena/config.yaml on macOS
  8. ./config.yaml in the current working directory

If no file exists, Athena copies the bundled default config into the first writable location.

Explicit overrides

OverrideMeaning
ATHENA_CONFIG_PATHExplicit config file path
--config <path> / --config-path <path>CLI override for config file path
--pipelines <path>Override config/pipelines.yaml
--port <port>Override API port at startup
--api-onlyStart the server rather than running another CLI subcommand

Top-level config.yaml sections

SectionPurpose
urlsNamed upstream/base URLs used by Athena routes and tooling
hostsNamed host/domain values
authenticatorPer-service auth credentials (for example Athena or Scylla)
apiHTTP listener, cache, timeout, and CORS behavior
gatewayRouting, resilience, admission, deferred queue, insert window, and telemetry behavior
backupS3-compatible backup storage configuration
postgres_clientsLogical client name → Postgres URI registry
validation_rangesNumeric min/max clamps for config values and runtime env vars

urls, hosts, and authenticator

urls

urls is a list of single-entry maps. Each key is a logical service name and each value is the resolved URL or an env placeholder.

Example:

urls:
	- athena: "${ATHENA_DB_URL}"

hosts

hosts works the same way, but stores named host strings used by the application.

Example:

hosts:
	- athena: athena-db.com
	- scylladb: "${SCYLLADB_HOST}"

authenticator

authenticator stores per-service credential objects.

Example:

authenticator:
	- scylladb:
			username: "${SCYLLADB_USERNAME}"
			password: "${SCYLLADB_PASSWORD}"

postgres_clients

postgres_clients defines the logical Postgres pools Athena will try to create at boot.

Key patternMeaning
postgres_clients[].<client_name>Postgres URI or env placeholder for that logical client

Example:

postgres_clients:
	- athena_logging: "${POSTGRES_ATHENA_LOGGING_URI}"
	- athena_benchmark: "${POSTGRES_ATHENA_BENCHMARK_URI}"

Behavior notes

  • Failed Postgres clients log warnings and are skipped; startup continues with healthy clients.
  • gateway.logging_pg_uri can override the URI used for the configured logging client.
  • Catalog-backed clients from athena_clients can extend the registry after bootstrap when enabled.

api section reference

KeyTypeDefault / typical valueMeaning
api.portinteger4052HTTP listen port
api.immortal_cachebooleanfalseEnables non-expiring cache behavior where supported
api.cache_ttlinteger seconds240Default in-memory cache TTL
api.pool_idle_timeoutinteger seconds90Reqwest HTTP client pool idle timeout
api.keep_alive_secsinteger seconds15HTTP keep-alive timeout
api.client_disconnect_timeout_secsinteger seconds60Time to wait for client disconnect completion
api.client_request_timeout_secsinteger seconds60Upper bound for request handling
api.http_workersinteger8Number of Actix workers
api.http_max_connectionsinteger10000Max listener connections
api.http_backloginteger2048TCP listen backlog
api.tcp_keepalive_secsinteger seconds75TCP keepalive duration
api.cors_allow_any_originbooleanfalse if omittedAllow all CORS origins
api.cors_allowed_originscomma-separated stringnoneExplicit allowlist of origins
api.prometheus_metrics_enabledbooleantrue if omittedEnable /metrics exporter

API env helpers

VariableMeaning
ATHENA_CORS_ALLOWED_ORIGINSComma-separated extra CORS origins merged with api.cors_allowed_origins

gateway section reference

Routing and shaping

KeyTypeDefaultMeaning
gateway.force_camel_case_to_snake_casebooleanfalseNormalize incoming field names to snake_case
gateway.auto_cast_uuid_filter_values_to_textbooleantrueCast UUID-like filter values to text when Athena casts the compared column
gateway.allow_schema_names_prefixed_as_table_namebooleantrueAllow public.table style names in information_schema lookups
gateway.logging_clientstringnoneLogical Postgres client for logs, audit rows, deferred queue, and catalog tables
gateway.auth_clientstringfalls back to logging_clientLogical Postgres client for API key and auth storage
gateway.benchmark_clientstringfalls back to logging_clientLogical client used by benchmark tooling
gateway.logging_pg_uristring / env placeholdernoneDirect URI override for the logging client
gateway.logging_pg_uri_env_varstringnoneEnv-var indirection for the logging client override

Direct JDBC routing and safety

KeyTypeDefaultMeaning
gateway.jdbc_allow_private_hostsbooleantrueAllow direct JDBC URLs pointing at private/local hosts
gateway.jdbc_allowed_hostscomma-separated stringemptyOptional allowlist for JDBC destination hosts

Read resilience

KeyTypeDefaultMeaning
gateway.resilience_timeout_secsinteger seconds30Per-operation read timeout
gateway.resilience_read_max_retriesinteger1Max retries for transient read failures
gateway.resilience_initial_backoff_msinteger ms100Initial retry backoff

Admission limiting and deferred queue

KeyTypeDefaultMeaning
gateway.admission_limit_enabledbooleanfalseEnable admission limiting middleware
gateway.admission_window_secsinteger seconds1Fixed window size
gateway.admission_global_requests_per_windowinteger0Global request budget per window (0 means unlimited)
gateway.admission_per_client_requests_per_windowinteger0Per-client request budget per window (0 means unlimited)
gateway.admission_defer_on_limit_enabledbooleanfalseDefer eligible requests instead of rejecting them
gateway.admission_defer_route_prefixescomma-separated string"/pipelines" in sample configWhich route prefixes can be deferred on limit
gateway.deferred_query_worker_enabledbooleantrueEnable background deferred worker
gateway.deferred_query_worker_poll_msinteger ms1000Deferred worker poll interval
gateway.admission_store_backendstringredisAdmission state backend (memory or redis)
gateway.admission_store_fail_modestringfail_closedBehavior when admission store is unavailable

Insert windowing and batching

KeyTypeDefaultMeaning
gateway.insert_execution_window_msinteger ms0Default batching window for /gateway/insert; 0 disables unless request header enables it
gateway.insert_window_max_batchinteger100Max merged rows per bulk insert
gateway.insert_window_max_queuedinteger10000Queue capacity before falling back to direct execution
gateway.insert_merge_deny_tablescomma-separated stringemptyTables that must not be bulk-merged

Client catalog and startup stats

KeyTypeDefaultMeaning
gateway.database_backed_client_loadingbooleantrueLoad runtime clients from athena_clients after boot
gateway.client_statistics_startup_refresh_modestringfastfast or full refresh of aggregate client statistics on startup
gateway.client_statistics_startup_refresh_lookback_daysinteger0Optional startup stats aggregation lookback (0 means all rows)
gateway.api_key_fail_modestringfail_closedAuth behavior when the API key store is unavailable

backup section reference

backup stores S3-compatible backup defaults. In practice, most deployments use env vars directly.

KeyTypeMeaning
backup.s3_bucketstringBucket name
backup.s3_regionstringAWS/S3 region
backup.s3_endpointstringCustom S3-compatible endpoint
backup.s3_prefixstringPrefix/folder used for uploaded backups

Backup and restore env vars

VariableMeaning
ATHENA_BACKUP_S3_BUCKETRequired bucket name
ATHENA_BACKUP_S3_REGIONOptional region
ATHENA_BACKUP_S3_ACCESS_KEYOptional access key
ATHENA_BACKUP_S3_SECRET_KEYOptional secret key
ATHENA_BACKUP_S3_ENDPOINTOptional S3-compatible endpoint
ATHENA_BACKUP_S3_PREFIXOptional object prefix
ATHENA_PG_DUMP_PATHExplicit path to pg_dump
ATHENA_PG_RESTORE_PATHExplicit path to pg_restore

validation_ranges reference

validation_ranges lets the config file define numeric min/max clamps for both file-based config values and runtime environment variables.

validation_ranges.config

These keys clamp values read from config.yaml:

  • api.port
  • api.cache_ttl
  • api.pool_idle_timeout
  • api.keep_alive_secs
  • api.client_disconnect_timeout_secs
  • api.client_request_timeout_secs
  • api.http_workers
  • api.http_max_connections
  • api.http_backlog
  • api.tcp_keepalive_secs
  • gateway.insert_execution_window_ms
  • gateway.insert_window_max_batch
  • gateway.insert_window_max_queued
  • gateway.resilience_timeout_secs
  • gateway.resilience_read_max_retries
  • gateway.resilience_initial_backoff_ms
  • gateway.admission_global_requests_per_window
  • gateway.admission_per_client_requests_per_window
  • gateway.admission_window_secs
  • gateway.deferred_query_worker_poll_ms

validation_ranges.env

These keys clamp runtime env settings loaded through RuntimeEnvSettings.

Runtime env settings (src/config_validation.rs)

These settings do not live under api or gateway in config.yaml; they are direct environment variables with internal defaults and optional min/max clamps.

VariableDefaultMeaning
ATHENA_POOL_MONITOR_INTERVAL_SECS30Pool monitor sample interval
ATHENA_POOL_MONITOR_RETENTION_HOURS24Connection snapshot retention
ATHENA_VACUUM_HEALTH_INTERVAL_SECS3600Vacuum-health collector interval
ATHENA_VACUUM_HEALTH_RETENTION_DAYS30Vacuum-health retention
ATHENA_VACUUM_HEALTH_STATEMENT_TIMEOUT_MS60000Vacuum-health statement timeout
ATHENA_CLIENT_RECONNECT_INTERVAL_SECS20Retry interval for reconnecting unavailable catalog clients
ATHENA_CACHE_MAX_CAPACITY10000Max request-cache entries/weight budget
ATHENA_CACHE_MAX_ENTRY_WEIGHT262144Per-entry cache weight cap
ATHENA_PG_POOL_MAX_CONNECTIONS100SQLx pool max connections per logical client
ATHENA_DEADPOOL_WARMUP_TIMEOUT_MS800Deadpool warmup timeout
ATHENA_PG_POOL_MAX_LIFETIME_SECS900SQLx pool max lifetime
ATHENA_PG_POOL_MIN_CONNECTIONS0SQLx pool min connections
ATHENA_PG_POOL_ACQUIRE_TIMEOUT_SECS8SQLx acquire timeout
ATHENA_PG_POOL_IDLE_TIMEOUT_SECS120SQLx idle timeout
ATHENA_DEFERRED_MAX_ATTEMPTS3Deferred-request retry count
ATHENA_DEFERRED_WORKER_NO_STORAGE_POLL_MS30000Deferred worker backoff when storage is unavailable
ATHENA_DEADPOOL_CHECKOUT_TIMEOUT_MS800Deadpool checkout timeout
ATHENA_FETCH_SINGLEFLIGHT_WAIT_TIMEOUT_MS5000Cache singleflight wait timeout
ATHENA_CACHE_INVALIDATION_WINDOW_MS25Cache invalidation coalescing window
ATHENA_REDIS_OP_TIMEOUT_MS30Redis operation timeout
ATHENA_REDIS_COOLDOWN_MS5000Temporary Redis bypass cooldown after failure
ATHENA_VACUUM_HEALTH_BLOAT_DEAD_PCT10.0Bloat threshold for warnings
ATHENA_VACUUM_HEALTH_XID_RISK_PCT50.0Transaction-ID risk threshold
ATHENA_REALTIME_REGISTRY_PURGE_INTERVAL_SECS30Realtime connection registry purge cadence
ATHENA_REALTIME_REGISTRY_INACTIVE_AFTER_SECS300Realtime connection inactivity window

Other important environment variables

These are widely used operational variables that are not part of RuntimeEnvSettings but matter in most Athena deployments.

VariableMeaning
POSTGRES_ATHENA_LOGGING_URILogging database connection URI
POSTGRES_ATHENA_BENCHMARK_URIBenchmark-target database connection URI
ATHENA_BENCHMARK_CLIENTBenchmark client name for cargo bench --bench gateway_e2e
ATHENA_REDIS_URLEnable Redis write-through cache and admission-store backend
ATHENA_KEY_12Static admin key used by admin/control-plane routes
ATHENA_WILDCARD_HOST_PATTERNWildcard host routing pattern
ATHENA_WILDCARD_HOST_ROUTING_ENABLEDToggle wildcard host routing
ATHENA_PG_TOOLS_ALLOW_DOWNLOADAllow auto-download of Postgres tools when not on PATH
ATHENA_CORS_ALLOWED_ORIGINSExtra allowed origins merged into config

Operational guidance

Shared logging pool

If gateway.logging_client and gateway.auth_client point to the same logical client, auth, request logs, operation logs, deferred queue rows, admission events, and aggregate stats can all compete for one Postgres pool. For deep dives, read:

  • docs/architecture_gateway_pool_starvation.md
  • docs/architecture_gateway_client_stats_batcher.md

Startup behavior

  • Missing or unreachable Postgres clients do not hard-stop the process; Athena starts with the reachable subset.
  • Config-backed clients and database-backed catalog clients merge into one in-memory registry.
  • Numeric values can be silently clamped to configured validation_ranges limits; watch logs for normalization warnings.

Safe authoring tips

  • Prefer env placeholders for secrets: "${POSTGRES_ATHENA_LOGGING_URI}"
  • Keep gateway.logging_client, gateway.auth_client, and gateway.benchmark_client explicit in production
  • Use validation_ranges when you want guardrails for operators editing config by hand