Skip to content

Reliability

Pummelchen edited this page Sep 16, 2026 · 6 revisions

Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Self-Hosting · Monitor · Testing · Troubleshooting · Project Tracker


The governing rule

A single vendor outage must never turn a potentially successful search into a hard tool failure. A search returns an error only when no provider can produce a usable result, or when the request itself is invalid.

Everything on this page exists to enforce that rule.


Timeouts

Each mode has one whole-search wall-clock budget, not a per-provider timeout:

Mode Budget Default
fast SEARCH_FAST_TIMEOUT_MS 12 000 ms
balanced SEARCH_BALANCED_TIMEOUT_MS 15 000 ms
thorough SEARCH_THOROUGH_TIMEOUT_MS 20 000 ms

Behaviour when the budget expires:

  • Providers that already answered keep their results.
  • Providers still running are cancelled and recorded as timeout failures.
  • Providers still in flight count as attempted, so an expired budget never reads as "nothing was tried".
  • The timeout is still counted and shown by web_search_status, but the shared deadline deliberately does not reach the circuit breaker: it is one wall-clock budget for the whole fan-out, so charging it to every slow provider would open breakers no provider earned.
  • The call succeeds if anything usable came back.

Beneath the budget there is a single bound on one request attempt: SEARCH_REQUEST_TIMEOUT_MS (default 10 s). It covers connection establishment as well as the wait for data. There is no separate connect-timeout setting — the transport exposes no connect-only deadline, and a knob nothing reads is worse than no knob — so SEARCH_REQUEST_TIMEOUT_MS is what bounds a stalled connection.


Retries

Aspect Behaviour
Eligible requests Idempotent only — GET, HEAD, PUT, DELETE
Eligible statuses 408, 425, 429, 500, 502, 503, 504
Never retried Every other 4xx, including 400, 401, 403, 404
Attempts 1 initial + SEARCH_MAX_RETRIES (default 2)
Backoff Exponential with full jitter across [0.5×, 1.5×] of 200 ms, then 500 ms
Retry-After Honoured when supplied, capped so a hostile server cannot stall a search

Search requests sent by POST are deliberately not retried. Tavily and Exa search over POST; a retry consumes provider credits and may duplicate an effect. Retrying them to chase a marginal success rate is the wrong trade.

Authentication and validation failures are never retried, because retrying a bad key cannot succeed and only burns quota.


Circuit breakers

Each provider owns an independent breaker.

State Meaning
closed Normal operation
open Skipped entirely until the cooldown expires
half_open Exactly one probe request is permitted
Setting Default
Failures to open 3 consecutive transient failures
Cooldown 30 s
Close condition One successful probe

Only transient categories — rate_limited, timeout, network, server_error — count toward opening a breaker. Authentication, configuration and malformed-response failures are recorded and surfaced but never trip it: waiting cannot fix a bad key, and hiding a real error behind an open breaker makes diagnosis harder.

The half-open probe is claimed by the first caller only, so a burst of concurrent searches cannot all hammer a recovering provider.


Rate limiting

Each provider has a token bucket, treated as a ceiling rather than a quota to spend.

Provider class Burst Sustained Minimum interval
JSON APIs 4 60 / min —
Self-hosted SearXNG 2 30 / min 500 ms
Opt-in scrapers 1 10 / min 1 500 ms

A denial is reported as a rate_limited failure rather than making the caller wait, because waiting on the first pass would consume the whole search budget when another provider could already answer.

Two exceptions avoid a hard failure when waiting is the only alternative to nothing:

  • One last-resort wait. If the whole search comes back empty and the only cause was local skips, the orchestrator makes one more pass that waits out an affordable local throttle instead of failing. The wait is bounded twice — at most 6 s and at most half of what remains of the search budget — so a large estimate cannot eat the search. This is the fix for the measured single-provider failure mode below.
  • Fan-out refill. A provider skipped locally (open breaker or empty token bucket) does not waste its selection slot: the orchestrator refills from the next candidate in the same preference order. Only providers that were never contacted are replaced — an upstream failure was a real attempt and is never given a second provider's quota.

Caching

Property Value
Storage In memory, bounded (256 entries, oldest evicted)
Key Normalized query + filters + mode + provider set
TTL SEARCH_CACHE_TTL_SECONDS (default 120 s; 0 disables)
Cached Successful responses with at least one result
Never cached Failures, and empty result sets

Provider set is part of the key because a fast reply from one provider and a thorough fused reply are different products and must not alias. Page content fetched by web_open is not cached.


Failover in practice

Scenario Outcome
One provider returns 429 Others answer; failure recorded; breaker tracks it
One provider returns 503 Retried if idempotent, then recorded as a transient failure
One provider times out Cancelled at the budget; answered providers keep results; breaker not charged
One provider has a bad key Reported as authentication; breaker stays closed so it keeps reporting
All providers answer with an error providersFailed, carrying each provider's real category and message
Every provider was skipped locally temporarilyUnavailable ("nothing was attempted"), after the last-resort wait has been tried
A provider is skipped by its breaker or limiter Recorded as circuit_open/rate_limited; the slot is refilled from the next candidate
No provider configured Actionable error naming the environment variable to set

Every degraded outcome is visible: providers_failed carries the category and message, and warnings summarises what happened.


Tuning

The defaults suit a machine on an ordinary connection. Two knobs cover most situations:

export SEARCH_REQUEST_TIMEOUT_MS=10000    # ceiling for a single HTTP request
export SEARCH_MAX_RETRIES=2               # retries per provider, retryable failures only
export SEARCH_BALANCED_TIMEOUT_MS=15000   # the whole `balanced` search budget

A search does not fail because one provider is slow. The budget ends the search, the results already gathered are returned, and the providers that did not answer are named in the response — so a partial answer is visibly partial rather than quietly thinner.

Observability

web_search_status is the operator's view: per-provider status, circuit state, request and failure counters, average latency, last error with category, and a note explaining why an inactive provider is inactive — for example "Set SEARXNG_BASE_URL to a self-hosted instance with JSON enabled."

Logging goes to stderr only, with a stable query hash instead of the query text unless SEARCH_LOG_QUERIES is enabled. See Configuration.


Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker

Clone this wiki locally