skip to content

A connector's first crawl of two million wiki pages must share the wiki's API quota with its users and other integrations: how do you budget and order it?

level: seniorimportance: should knowfreq 36%

answer

  1. count requests, not pages
  2. an agreed share, with headroom
  3. nights and weekends are cheaper
  4. most-used content first
  5. permissions travel with content

basics

~20 s

Count requests per page, agree a quota share with the source owner, reserve some for live changes, run faster off-hours, slow down on throttling signals, and crawl the most-used spaces first so the assistant is useful early.

solid answer

~50 s

I start from requests, not pages: listing, content, permissions and attachments might come to about 2.5 calls a page, so two million pages is roughly five million requests. I agree a **share of the quota** with the source owner, leaving the wiki's users and other integrations most of it, and reserve a slice of my share for live changes so the change feed keeps running during the backfill. In the scenario where the quota is 100 requests a second, a 30% share by day and 60% at night, less the live-change reserve, puts the crawl at about 35 hours, against about 56 at the daytime rate alone. I watch any remaining-quota signals the API returns and slow down on throttling before users feel it. And I **order** the crawl by value: spaces with the most views and recent edits first, each page's permissions fetched with its content, checkpointed per space so a restart resumes.

go deeper

for a junior

Recall that source APIs have request quotas shared with other users of the source, and that a crawl needs several requests per page.

for a middle

Explain how to turn pages into a request count, pace a crawl to an agreed rate and respond to throttling responses without hammering the source.

for a senior

Size the crawl in hours from the quota share, schedule faster off-hours, reserve capacity for live changes, and order it by value with permissions fetched alongside content and per-space checkpoints.

for a principal

Treat the quota share as an agreement with the source owner, and decide which content is worth crawling at all; skipping cold archives can cut the plan more than any tuning.

## Why the first crawl is a capacity problem A connector's **first crawl** (the initial backfill of a source) reads everything the source holds. On a large wiki that is millions of API requests, and many sources apply a **request quota** per tenant, per application or per user, sometimes counted in points where some calls cost more than others. The quota is shared: the wiki's own users, its other integrations and the connector all draw from it. A crawl that takes the whole quota slows the wiki for the people writing in it, and gets the connector throttled or its credential revoked. The design question is how much of the quota to use, when, and in what order. ## Count requests, not pages The figures below are a scenario's, for illustration. | Call type | Calls per page | Requests for 2,000,000 pages | |---|---|---| | Listing (100 pages per listing call) | 0.01 | 20,000 | | Page content | 1 | 2,000,000 | | Effective permissions | 1 | 2,000,000 | | Attachment metadata (about half the pages) | 0.5 | 1,000,000 | | **Total** | **about 2.5** | **about 5,000,000** | Where the API offers a call that returns content and permissions together, or expands several pages in one request, the per-page count drops and so does the whole plan. ## Budget a share, by time of day In the same scenario the tenant's quota is 100 requests per second, and the source owner agrees the connector may use 30% during business hours and 60% at night, keeping 5 requests per second of that for live changes. - Business hours: 30 − 5 = **25** requests per second for the crawl, over 12 hours: 25 × 43,200 = 1,080,000 requests. - Off-hours: 60 − 5 = **55** requests per second, over 12 hours: 55 × 43,200 = 2,376,000 requests. - Per day: 3,456,000 requests, so five million take about 1.45 days, roughly **35 hours**. - At a flat 25 requests per second it would be 5,000,000 ÷ 25 = 200,000 seconds, about **56 hours**. ## Stay inside the share 1. **Pace the connector** to its agreed rate with a local limiter, rather than discovering the limit by hitting it. 2. **Read the source's signals.** Many APIs return remaining-quota figures or a retry delay; slow down when the remainder falls, not only after a rejection. 3. **Back off on throttling** responses such as HTTP 429 and honour any retry delay the source sends; the mechanics of backoff and jitter are the general retry topic. 4. **Never work around the quota** with extra service accounts or credentials; check the source's terms, which often forbid it, and expect to lose its owner's trust either way. ## Order by value - **Size first.** A metadata-only listing pass costs about 20,000 requests in this scenario and tells you how many pages each space holds, how recently they changed and, where the source reports it, how often they are viewed. - **Most-used spaces first.** Crawl by views and recent edits, so the assistant answers well on the content people actually use within hours, while archives load later or not at all. - **Permissions with content.** Fetch each page's permissions in the same pass, so no chunk becomes retrievable before its access list is known. - **Checkpoint per space.** A crash resumes from the last finished space instead of restarting the crawl. - **Start the change feed first.** Take a change position before the crawl begins, so edits during a crawl that lasts days are replayed afterwards. ## Agree it with the source owner The share, the off-hours window and the order are a conversation with whoever runs the source, not a setting the connector picks alone. Some teams also schedule the first crawl over a weekend for the same reason. ```yaml # illustrative crawl budget for one source; every field name is invented source: team-wiki quota_share_percent: business_hours: 30 off_hours: 60 reserve_for_live_changes_rps: 5 ordering: - spaces_by_views_last_30_days - pages_by_last_modified_desc fetch_permissions_with_content: true checkpoint: per_space slow_down_when_remaining_quota_below_percent: 20 ```

  • The quota is per user rather than per application. Does the plan change?
    Yes. A crawl through one service account then competes only with that account's own limit, which may be far lower than the tenant's, so the plan may take much longer. Spreading the crawl across many users' credentials to multiply the limit is the workaround to refuse: the source's terms often forbid it, and it blurs whose access the connector reads with.
  • How does the assistant behave while the crawl is half done?
    It answers from the spaces loaded so far, which is why they are ordered by use. Record per source which spaces are complete, so the assistant can say a source is still loading instead of implying that content which has not arrived yet does not exist.

  • Run the first crawl at full speed; throttling will slow it down if needed.
  • Two million pages means two million requests.
  • Spread the crawl across extra service accounts to get more quota.
  • Crawl in the source's listing order; every page matters the same.
  • Fetch permissions in a later pass once all the content is indexed.