Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: createVectorStoreNode refactoring and embeddings batching support (no-changelog) #13674

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

OlegIvaniv
Copy link
Contributor

@OlegIvaniv OlegIvaniv commented Mar 4, 2025

Summary

  • Refactor vector store node architecture into modular operation-based components
  • Implement batched document embedding to reduce embeddings API calls and speed-up insertion
  • UI rendering performance optimizations with debounced node updates

Changes

Vector Store Architecture Improvements

  • Restructured createVectorStoreNode into separate modules organized by operation type
  • Created dedicated handlers for each operation (load, insert, retrieve, update, retrieve-as-tool)
  • Added test suite for each operation handler

Embedding Performance Optimization

  • Implemented batched document processing for vector store insertions
  • Added configurable batch size parameter to control embedding operations
  • For node version 1.1+, documents are processed in batches instead of individually
  • Single embedding operation performed per batch to significantly reduce API calls

UI Rendering Performance

  • Added debounced rendering of workflow nodes and connections in canvas
  • Implemented dynamic debounce timing based on workflow execution state:
    • Fast updates during editing (0ms debounce)
    • Throttled updates during execution (200ms debounce, 50ms max wait)
  • Reduces CPU/memory usage during execution with large workflows

In my tests populating 500 items to QDrant vector store went from ~5mins to 10s.

Before

CleanShot.2025-03-04.at.12.50.00121221.mp4

After

CleanShot.2025-03-04.at.12.46.28.mp4

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/AI-749

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

- Introduce new 'Embedding Batch Size' parameter for vector store nodes
- Support batched document processing in node version 1.1+
- Update documentation and tests to reflect new batching functionality
@OlegIvaniv OlegIvaniv force-pushed the ai-749-speed-up-vector-store-ingestion branch from 04a8f4e to 579d8da Compare March 4, 2025 12:12
@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant