-
Notifications
You must be signed in to change notification settings - Fork 1
Architecture
OpenCrawling is designed for high-throughput, horizontal scalability. The platform is broken down into modular microservices that communicate asynchronously using Apache Kafka.
The architecture is divided into the following primary layers:
The central orchestrator that schedules, runs, and monitors crawling jobs. It executes the crawlers, manages rate-limiting, and stores job states in PostgreSQL.
Houses the main crawler SPI definitions. Once a crawler discovers a document, the core engine saves the file content to shared storage and publishes a lightweight pointer to the queue.
A stateless microservice that pulls text chunks from Kafka, requests vector embeddings from the configured AI engine (such as local Ollama instances or cloud OpenAI endpoints), and publishes the resulting vectors. This microservice can be scaled out instantly:
docker compose scale oc-embedding-service=3Consumes embedded chunks and writes them directly to database outputs (such as PostgreSQL with pgvector, Elasticsearch, or Qdrant). It uses a stateless model to write raw vectors directly, bypassing model inference.
Exposes knowledge retrieval tools to AI models and agents using the Model Context Protocol (MCP). It handles SSE-based queries, authenticates user identities, and filters search results by matching document ACL tokens.
To avoid clogging Kafka partitions with megabytes of binary file data (PDFs, Excel files, DOCX), OpenCrawling uses the Claim Check Pattern:
[Repository] ββ(Crawl)ββ> [Crawler Engine] ββ(Save Raw)ββ> [Shared Storage]
β
(Publish IngestionMessage)
β
βΌ
[Kafka Ingestion Topic]
β
(Consume IngestionMessage)
β
βΌ
[IngestionConsumer (Apache Tika Text Extractor)]
β
(Read from Storage)
β
(Publish ChunkMessages to Kafka)
β
βΌ
[Kafka Chunks Topic]
β
[Embedding Service]
β
(Generate Vector)
β
βΌ
[Kafka Embedded Topic]
β
[Vector Store Writer]
β
βΌ
[pgvector]
-
Crawl & Check-In: The repository connector discovers a document. Instead of sending the full payload, it saves the file to a shared file/object storage and publishes an
IngestionMessage(the Claim Check) to Kafka. -
Text Extraction & Chunking: The
IngestionConsumerreads the message, fetches the file from storage, extracts text using Apache Tika, splits it into semantic chunks, and publishes them toopencrawling-chunks. -
Embedding Generation: The
oc-embedding-serviceconsumes chunks, generates embedding vectors, and pushes them toopencrawling-embedded. -
Vector Store Sync: The
VectorStoreWriterConsumersaves the vectors, metadata, and Security SIDs into the vector database.