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

enhancement:support Qdrant gRPC mode #3929

Merged
merged 46 commits into from
Apr 28, 2024
Merged

Conversation

leslie2046
Copy link
Contributor

@leslie2046 leslie2046 commented Apr 27, 2024

Description

According my test,gRPC mode seems take lower latency than REST mode.

次数 search (HTTP)latency(s) search (gRPC)latency(s) scroll(HTTP) latency(s) scroll (gRPC)latency(s) client(HTTP)初始化 client(gRPC)初始化
1 0.0489 0.0157 0.0132 0.0129 0.0043 0.0029
2 0.0490 0.0166 0.0129 0.0105 0.0037 0.0043
3 0.0453 0.0128 0.0172 0.0089 0.0028 0.0029
4 0.0569 0.0092 0.0164 0.0099 0.0040 0.0023
5 0.0494 0.0134 0.0136 0.0085 0.0032 0.0017
avg 0.0491 0.0135 0.0148 0.0107 0.0036 0.0028

User guide

docker deployment

  1. We can enable gRPC mode by setting these environment variables in api and worker container in docker-compose.yaml:
QDRANT_GRPC_ENABLED:  'true'    
QDRANT_GRPC_PORT: xxxx
  1. Add port mapping to port 6334 of the qdrant container as below:
   qdrant:
     image: langgenius/qdrant:v1.7.3
     restart: always
     volumes:
       - ./volumes/qdrant:/qdrant/storage
     environment:
       QDRANT_API_KEY: 'difyai123456'
     # uncomment to expose qdrant port to host
      ports:
       - "6333:6333"
       - "xxxx:6334"
  1. You can replace xxxx to your port

source deployment(api)

  1. Add 2 lines to api/.env as below:
QDRANT_GRPC_ENABLED=true
QDRANT_GRPC_PORT=xxxx
  1. You can replace xxxx to your port

Fixes # (issue)

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • TODO

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. labels Apr 27, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Apr 28, 2024
@takatost takatost requested a review from JohnJyong April 28, 2024 05:16
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 28, 2024
@JohnJyong JohnJyong merged commit 0940f01 into langgenius:main Apr 28, 2024
7 checks passed
@takatost takatost mentioned this pull request May 2, 2024
@leslie2046 leslie2046 deleted the qdrant-enh branch May 9, 2024 03:40
dengpeng pushed a commit to dengpeng/dify that referenced this pull request Jun 16, 2024
HuberyHuV1 pushed a commit to HuberyHuV1/dify that referenced this pull request Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants