Skip to content
Skillv1.0.0

notion-load-scale

Use when you must move high volumes through the Notion API without tripping its 3 req/sec limit — bulk-creating pages, syncing 100K+ record databases, or running background jobs. Covers parallel reque

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (skills/.curated/notion-load-scale/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill notion-load-scale. Copyright stays with the author (MIT).

Notion Load & Scale

Overview

Patterns for high-volume Notion API usage within the 3 requests/second rate limit. Covers parallel request orchestration with p-queue, worker queue architecture for background processing, full database pagination at scale (100K+ records), incremental sync using last_edited_time filters to avoid re-fetching unchanged data, and memory management for bulk operations via streaming and chunked processing.

Full runnable TypeScript + Python implementations for all three steps live in references/implementation.md; planning utilities live in references/examples.md.

Prerequisites

  • @notionhq/client v2.x installed (npm install @notionhq/client)
  • p-queue for rate-limited concurrency (npm install p-queue)
  • Python: notion-client installed (pip install notion-client)
  • NOTION_TOKEN set (each token gets its own 3 req/s limit)
  • Test database in Notion (dedicated for load testing)

Authentication

All operations authenticate with a Notion internal integration token in the NOTION_TOKEN environment variable; the SDKs send it as a Bearer token automatically. Each token has an independent 3 req/s limit — the key lever for horizontal scaling. Full auth notes, including raw curl headers, are in references/implementation.md.

Instructions

The three patterns compose: rate-limited calls (Step 1) are the primitive the worker queue (Step 2) and the streaming paginator (Step 3) both build on. Read the lean summary here, then open references/implementation.md for the complete code.

Step 1: Parallel Requests Within Rate Limits

Notion enforces 3 requests/second per integration token. Drive every call through a single p-queue tuned to interval: 340 / intervalCap: 1 (~3/s with a safety margin) rather than relying on concurrency alone, and wrap each call so a rate_limited (429) response honors retry-after and retries once.

import PQueue from 'p-queue';

const apiQueue = new PQueue({ concurrency: 1, interval: 340, intervalCap: 1 });

// Every Notion call goes through this queue; add 429 retry inside (see refs).
const results = await Promise.all(
  dbIds.map(id => apiQueue.add(() =>
    notion.databases.query({ database_id: id, page_size: 100 })
  ))
);

Full wrapper (metrics, retry-after handling, Python token-bucket variant) is in Step 1 of references/implementation.md.

Step 2: Worker Queue Architecture for Background Processing

For sustained high-volume writes, decouple API calls from user requests with a job queue. A NotionWorkerQueue wraps the same rate-limited p-queue, dispatches by job type (create/update/query/append), retries rate_limited jobs with exponential backoff, and routes jobs past maxRetries to a dead-letter list. See Step 2 of references/implementation.md for the full class plus a 500-page bulk-create example (~170s at 3/s).

Step 3: Pagination at Scale, Incremental Sync, Memory Management

For 100K+ record databases, stream pages through an async generator so results are processed a batch at a time instead of loading everything into memory. Layer incremental sync on top: filter by last_edited_time on_or_after your last run and persist the server-returned timestamp between runs — cutting subsequent API calls by 90%+.

async function* paginateDatabase(databaseId: string, filter?: any) {
  let cursor: string | undefined;
  do {
    const res = await notion.databases.query({
      database_id: databaseId, filter, page_size: 100, start_cursor: cursor,
    });
    yield res.results;                       // process a batch, then release it
    cursor = res.has_more ? res.next_cursor ?? undefined : undefined;
  } while (cursor);
}

Full streaming processor, incremental-sync driver with persisted state, and the Python generator + multi-token scaling helper are in Step 3 of references/implementation.md.

Output

  • Rate-limited parallel requests maximizing 3 req/s throughput
  • Worker queue with priority, retries, and dead letter handling
  • Streaming pagination for 100K+ record databases
  • Incremental sync reducing API calls by 90%+ on subsequent runs
  • Memory-efficient processing via async generators

Error Handling

Issue Cause Solution
Sustained 429 errors Exceeding 3 req/s Reduce intervalCap or increase interval
Memory growing during bulk read Loading all results into array Use async generator streaming
Stale incremental sync Clock skew between systems Use server-returned timestamps
Queue growing unbounded Write rate exceeds 3/s sustained Add more integration tokens (each gets own limit)
Timeout on large queries Notion API response time Reduce page_size, add retry logic
Duplicate records in sync Concurrent modifications Deduplicate by page ID after collection

Examples

  • Capacity Calculator — estimate whether a planned read/write mix fits your token budget before a bulk run (accounts for cache hit rate + multi-token scaling).
  • Quick Throughput Benchmark — time 10 sequential calls to measure baseline per-call latency without tripping the rate limit.

Both utilities, with full code, are in references/examples.md.

Resources

Next Steps

For reliability patterns, see notion-reliability-patterns. For architecture decisions at scale, see notion-architecture-variants.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-notion-load-scale/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-notion-load-scale.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-notion-load-scale",
  "kind": "skill",
  "name": "notion-load-scale",
  "description": "Use when you must move high volumes through the Notion API without tripping its 3 req/sec limit — bulk-creating pages, syncing 100K+ record databases, or running background jobs. Covers parallel requests within 3 req/sec, worker queues, database pagination at scale, incremental sync for large workspaces, and memory management for bulk operations. Trigger with phrases like \"notion scale\", \"notion bulk operations\", \"notion high volume\", \"notion worker queue\", \"notion incremental sync\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "saas",
      "productivity",
      "notion",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Use when you must move high volumes through the Notion API without tripping its 3 req/sec limit — bulk-creating pages, syncing 100K+ record databases, or running background jobs. Covers parallel requests within 3 req/sec, worker queues, database pagination at scale, incremental sync for large workspaces, and memory management for bulk operations. Trigger with phrases like \"notion scale\", \"notion bulk operations\", \"notion high volume\", \"notion worker queue\", \"notion incremental sync\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "skills/.curated/notion-load-scale/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/skills/.curated/notion-load-scale/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/skills/.curated/notion-load-scale/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Bash(node:*),",
      "Bash(npx:*)"
    ],
    "license": "MIT"
  },
  "instructions": "# Notion Load & Scale\n\n## Overview\n\nPatterns for high-volume Notion API usage within the 3 requests/second rate\nlimit. Covers parallel request orchestration with `p-queue`, worker queue\narchitecture for background processing, full database pagination at scale\n(100K+ records), incremental sync using `last_edited_time` filters to avoid\nre-fetching unchanged data, and memory management for bulk operations via\nstreaming and chunked processing.\n\nFull runnable TypeScript + Python implementations for all three steps live in\n[references/implementation.md](references/implementation.md); planning utilit",
  "cost": {
    "context_tokens": 1506
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-notion-load-scale/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.