skip to content

Source-to-Index Freshness

Freshness is the lag from a source edit to a retrievable chunk, budgeted per stage and per source, with deletes and revocations first. Interviewers ask because a stale answer still looks right.

part ofRetrieval-augmented generation (RAG)read it →
on this pageshow

questions

5

In a RAG ingestion pipeline fed by a polled HR handbook, a webhook-fed incident queue and a code repository indexed on merge, where does edit-to-retrievable lag go, stage by stage?

level: seniorimportance: must knowfreq 50%

answer

  1. four stages, four causes
  2. clock starts at the source edit
  3. queue wait versus service time
  4. a different dominant stage per source

basics

~20 s

Lag is detection plus parse plus embed plus write. The polled handbook is dominated by waiting for its next poll, the incident queue by embedding-queue wait under load, and the code repository by embedding the many chunks one merge produces.

solid answer

~40 s

Split the lag into **detection** (poll interval, webhook delivery or merge event), **fetch and parse**, **embed** (queue wait plus rate-limited service time) and **write**, which includes the store's own apply delay. Stamp every change at each boundary and compute per-source p95s from the source's modified time, not from job start. In this scenario the handbook polled every six hours waits up to six hours for detection while the rest takes about two minutes; the incident queue is seconds end to end until a bulk load fills the embedding queue; and a merge touching 400 files produces about 8,000 chunks, about four minutes of embedding at 2,000 chunks a minute. Each dominant stage has a different fix, so "the pipeline is slow" is never the diagnosis.

code

json · 12 lines
json
{
  "_note": "illustrative change record; field names are invented",
  "source": "code-repository",
  "doc_id": "repo:services/billing/README",
  "source_modified_at": "2026-03-02T10:00:00Z",
  "detected_at":        "2026-03-02T10:00:10Z",
  "parsed_at":          "2026-03-02T10:01:10Z",
  "enqueued_at":        "2026-03-02T10:01:10Z",
  "embed_started_at":   "2026-03-02T10:01:12Z",
  "embedded_at":        "2026-03-02T10:05:10Z",
  "written_at":         "2026-03-02T10:05:40Z"
}

go deeper

for a junior

Name the four stages a change passes through, detection, parse, embed and write, and know that a polled source waits for its next poll before anything starts.

for a middle

Explain how to stamp each change at every stage boundary, why queue wait and service time are measured apart, and why the clock starts at the source's modified time.

for a senior

Work each source through the stages with numbers, name its dominant stage and the fix that follows, and call out the stages outside the pipeline's control.

for a principal

Connect the stage breakdown to what the team can promise: a target per source, split into a budget per stage, that no stage outside your control makes impossible.

## The stages a change passes through Edit-to-retrievable lag is the time from a change in a source to the moment the changed chunks can be retrieved. It is a sum of stages, and each one has its own cause: 1. **Detection**: the wait until the pipeline learns of the change. For a polled source it is the poll interval; for a webhook, delivery time; for a code repository indexed on merge, the merge event. 2. **Fetch and parse**: downloading the document and turning it into clean text and chunks. 3. **Embed**: two parts, **queue wait** until the change's chunks reach the front of the embedding queue, and **service time** for the rate-limited embedding calls themselves. 4. **Write**: writing vectors and metadata to the vector store, plus however long that store takes to make an acknowledged write searchable. That last part is the store's behaviour; the pipeline treats it as one measured stage it does not explain. ## The three sources in this scenario The figures below are this scenario's, chosen to show how the dominant stage differs by source: | Source | Detection | Parse | Embed | Write | Dominant stage | Typical total | |---|---|---|---|---|---|---| | HR handbook, polled every 6 h | 0 to 6 h, mean 3 h | ~2 min | ~10 s | ~5 s | detection | up to about 6 h 2 min | | Incident queue, webhook | ~5 s | under 1 s | ~10 s | ~5 s | embed queue wait | about 20 s | | Code repository, on merge | ~10 s | ~1 min | ~4 min | ~30 s | embed service time | about 6 min | - **HR handbook.** The poll interval is almost everything. An edit made just after a poll waits the full six hours; the rest of the path adds about two minutes. Faster embedding barely changes anything here. Only a shorter interval or a change notification helps, and that choice, weighed against the source's request quota, belongs to the connector design. - **Incident queue.** Detection is near-instant, so the embedding queue decides. Normally the queue is short and the total is about twenty seconds. Under a burst, such as a bulk import sharing the queue, the same edit can wait hours while nothing else in its path has moved. - **Code repository.** A merge touching 400 files at about 20 chunks each is about 8,000 chunks. At this scenario's throughput of 2,000 chunks per minute that is four minutes of embedding service time, more than every other stage combined. Re-embedding only the chunks a change actually altered is the lever here, and that is covered with chunk boundaries under churn. ## How to measure it Stamp every change record with the time it crossed each boundary: `source_modified_at` (reported by the source), `detected_at`, `parsed_at`, `enqueued_at`, `embed_started_at`, `embedded_at` and `written_at`. The difference between neighbouring stamps is each stage's time. Group those per source and take the median and the p95. Three rules keep the numbers honest: - **Start the clock at the source's modified time, not at detection.** A dashboard that measures from job start to write shows the handbook as two minutes fresh while it is six hours behind. - **Split queue wait from service time.** `embed_started_at - enqueued_at` is waiting; `embedded_at - embed_started_at` is work. They have different fixes. - **Watch the p95, not the mean.** Detection waits spread evenly over the poll interval and queue waits are spiky, so a mean hides both worst cases. Source clocks can disagree with the pipeline's. Where a source reports a modified time, check it against `detected_at` for impossible negative lags and treat large skew as its own defect. ## Reading the result Once each source's dominant stage is known, the fix follows from it: - **detection-dominated:** change the detection path, if the source's target needs it; - **queue-wait-dominated:** separate lanes, so bulk work cannot sit in front of live edits; - **service-time-dominated:** send fewer chunks per change, or buy more throughput; - **write-dominated:** look at the store's apply behaviour, which sits outside the pipeline. Turning these measurements into a formal service-level objective with alerting is covered with search-index builds. The design point here is that "the pipeline is slow" is never the diagnosis: one stage is slow, for one source, for one reason, and the stage stamps say which.

  • Why must lag be measured from the source's modified time rather than from detection?
    Because detection is often the largest stage. A polled source's edits wait up to a full interval before the pipeline sees them, and a clock started at detection never counts that wait. The dashboard then reports minutes for a source that is hours behind, and the stage that most needs a decision stays invisible.
  • The incident queue's median lag stays at twenty seconds but its p95 jumps to two hours one afternoon. What do you check first?
    Split the embed stage into queue wait and service time for that afternoon. If the gap from enqueue to embedding start explains the jump, something shared the queue, usually a bulk job, and the fix is lanes. If detection explains it, webhooks were delayed or dropped and picked up later by a backstop, which is a connector problem.
  • Which stages can the pipeline not shorten by its own work?
    Two sit outside it: how quickly a source's change API or notifications report an edit, and how long the vector store takes to make an acknowledged write searchable. The pipeline measures both, budgets for them, and should not promise a lag below their sum.

  • Faster embedding will fix lag for every source.
  • Lag measured from job start to index write is the freshness number.
  • The mean lag is enough to judge a source's freshness.
  • All sources share one dominant stage, so one fix fits all.
  • Webhook-fed sources cannot fall behind because detection is instant.
open as a page

Why should a RAG assistant tell users when a cited source is behind, and what must its ingestion pipeline record to do that?

level: juniorimportance: should knowfreq 35%

basics

~20 s

A stale answer reads as fluent and well cited as a fresh one, so users rarely spot it. The pipeline must record, per source, the time up to which changes are confirmed indexed, and per chunk its source's modified time.

open as a page

In a RAG ingestion pipeline, why should deletes and permission revocations overtake queued edits, and what makes them cheap to fast-track?

level: middleimportance: should knowfreq 45%

basics

~20 s

A late edit serves stale text; a late delete or revocation keeps serving content that is gone or that a user may no longer see. Both skip parsing and embedding, so a fast lane costs little more than an index write.

open as a page

When a bulk migration floods a RAG pipeline's embedding queue and live incident edits wait hours to become retrievable, how do you protect live freshness?

level: seniorimportance: should knowfreq 42%

basics

~20 s

Live edits waited behind the whole bulk backlog in one shared queue. Tag work by origin, give live edits their own lane with a reserved share of embedding throughput that bulk may borrow when idle, and feed the migration in bounded pages.

open as a page

How would you set the freshness targets an assistant commits to for an HR handbook, an incident queue and a code repository, and what does each target cost?

level: principalimportance: should knowfreq 32%

basics

~20 s

Set each target from how soon people ask after a change and how harmful a stale answer is, then price it: detection, reserved embedding and churn spend. Give deletes and revocations tighter targets and split each target into per-stage budgets.

open as a page