@pauliusztin_: I used to think ingesting 1,000,000 documents into an AI memory system was mostly a compute problem. But I've been prov…
Summary
The author discusses the architecture for scaling AI memory ingestion from thousands to millions of documents, emphasizing orchestration and parallelism over raw compute power, and using Prefect for workflow management.
View Cached Full Text
Cached at: 07/04/26, 08:53 PM
I used to think ingesting 1,000,000 documents into an AI memory system was mostly a compute problem. But I’ve been proven wrong…
This is an orchestration problem.
Throwing more GPUs at the pipeline won’t help much if your architecture still processes everything sequentially.
The system I’ve been designing separates ingestion into two independent work pools.
The first turns raw data into documents. The second turns those documents into memory.
Here’s the high-level architecture:
1/ Two levels of paralleism
Imagine ingesting 1,000,000 documents.
A @PrefectIO workflow shards them into 1,000-document jobs.
Each worker then processes those jobs in batches of 100.
That gives you two levels of parallelism:
- Pipeline parallelism → distribute shards across workers.
- Task parallelism → batch expensive operations inside each worker.
Need more throughput for LLMs or embeddings?
Swap in a Dask or Ray cluster without changing the architecture.
2/ Data work pool
The pipeline starts with:
Web URLs RSS feeds
A @PrefectIO workflow flattens every source into URLs, shards them into jobs, and pushes them into a queue.
Workers continuously pull jobs as capacity becomes available, making it easy to absorb traffic spikes by simply adding more workers.
Each worker:
Flattens URLs Scrapes 100 URLs concurrently Transforms content Batch-loads documents into storage
This stage is mostly network and database I/O.
Batching matters far more than compute.
3/ Memory work pool
Once documents reach the warehouse, a second @PrefectIO workflow repeats the pattern.
Each worker runs:
Chunking Batched LLM extraction Entity normalization Batched embeddings Knowledge graph generation
For example, 1,000 documents might become 10,000 chunks, processed in batches of 100.
Every stage has different bottlenecks.
LLM extraction → vLLM Entity normalization → database I/O Embeddings → often CPU
Treating them all the same leaves performance on the table.
Here’s the gist:
Scaling AI memory isn’t about adding GPUs.
It’s about designing an architecture where every bottleneck scales independently.
This is why I chose @PrefectIO.
It orchestrates both pipelines with sharding, queues, retries, scheduling, and durable execution, making it practical to scale from thousands to millions of documents.
P.S. What would stop your pipeline from ingesting one million documents today?
Similar Articles
@Oliviacoder1: MIT just made every AI company's billion dollar bet look embarrassing. They solved AI memory. Not by building a bigger …
MIT CSAIL researchers propose a novel approach to AI memory that avoids context rot by storing documents externally and having the AI navigate and query them, achieving 10 million token effective context at lower cost.
@tricalt: https://x.com/tricalt/status/2057173322924806651
A founder discusses the scaling challenges of using markdown files for AI agent memory in production, highlighting common pitfalls with permissions, multi-agent interaction, and temporal queries, and suggests that teams often end up patching around these issues without realizing they are rebuilding a more complex system.
@pvergadia: 9-layer AI production architecture every developer must know. → services/ RAG pipeline, semantic cache, memory, query r…
This post outlines a comprehensive 9-layer AI production architecture, emphasizing components like RAG pipelines, security guards, observability, and evaluation to distinguish robust production systems from simple demos.
@mvanhorn: https://x.com/mvanhorn/status/2070966613994795489
The author argues that AI agent memory bloat degrades performance, and recommends keeping memory and CLAUDE.md files under 200 lines, using on-demand retrieval instead of loading everything into context.
Last week I built an AI Agent, this week I added memory!
A developer shares their experience building an AI agent with memory using the Anthropic SDK and TypeScript, explaining the differences between working, episodic, semantic, and procedural memory and the challenges of scaling memory for production.