Skip to main content

Qdrant Variables

Qdrant vector database configuration for RAG (Retrieval-Augmented Generation).

Overview

Qdrant is the vector database used by Chatty AI for:

  • Storing document embeddings
  • Semantic search
  • RAG (Retrieval-Augmented Generation)
  • Similarity matching

Connection Variables

QDRANT_URI

  • Type: String (URL)
  • Required: No (auto-set)
  • Default: http://qdrant:6333
  • Example: http://qdrant:6333
  • Description: Qdrant HTTP API endpoint
  • Used in: chattyai service, chattydatabases-ai-service
  • Auto-generated: Yes (in docker-compose)

QDRANT_HOST

  • Type: String
  • Required: No (auto-set)
  • Default: qdrant
  • Example: qdrant
  • Description: Qdrant hostname for Databases AI service
  • Used in: chattydatabases-ai-service
  • Auto-generated: Yes (in docker-compose)

Feature Configuration

ENABLE_QDRANT_MULTITENANCY_MODE

  • Type: Boolean
  • Required: No
  • Default: true
  • Values: true or false
  • Description: Enable multi-tenancy mode for Qdrant collections
  • Used in: chattyai service
  • Effect:
    • true: Separate collections per user/workspace
    • false: Shared collections

Performance Tuning

QDRANT_HNSW_M

  • Type: Integer
  • Required: No
  • Default: 48
  • Example: 48
  • Description: HNSW index parameter M (number of bi-directional links)
  • Used in: chattyai service
  • Range: 4-64
  • Impact:
    • Higher = Better recall, more memory
    • Lower = Less memory, faster indexing
  • Recommended:
    • Small datasets: 16
    • Medium datasets: 32-48
    • Large datasets: 48-64

QDRANT_HNSW_EF_CONSTRUCT

  • Type: Integer
  • Required: No
  • Default: 100
  • Example: 100
  • Description: HNSW index construction parameter
  • Used in: chattyai service
  • Range: 100-500
  • Impact:
    • Higher = Better index quality, slower construction
    • Lower = Faster construction, lower quality

Qdrant Service Configuration

These are set directly in the Qdrant container (not in .env):

QDRANT__SERVICE__HTTP_PORT

  • Value: 6333
  • Description: HTTP API port

QDRANT__SERVICE__MAX_REQUEST_SIZE_MB

  • Value: 500
  • Description: Maximum request size in MB

QDRANT__SERVICE__MAX_WORKERS

  • Value: 12
  • Description: Maximum worker threads

QDRANT__COLLECTION__REPLICATION_FACTOR

  • Value: 1
  • Description: Number of replicas for collections

QDRANT__COLLECTION__WRITE_CONSISTENCY_FACTOR

  • Value: 1
  • Description: Write consistency level

QDRANT__STORAGE__PERFORMANCE__OPTIMIZERS__MEMMAP_THRESHOLD_KB

  • Value: 500000
  • Description: Memory mapping threshold (500MB)

QDRANT__STORAGE__PERFORMANCE__OPTIMIZERS__INDEXING_THRESHOLD_KB

  • Value: 10000
  • Description: Indexing threshold (10MB)

QDRANT__STORAGE__PERFORMANCE__WAL_CAPACITY_MB

  • Value: 1024
  • Description: Write-ahead log capacity (1GB)

QDRANT__STORAGE__PERFORMANCE__OPTIMIZERS__VACUUM_MIN_VECTOR_NUMBER

  • Value: 10000
  • Description: Minimum vectors before vacuum operation

Resource Limits

Qdrant container resource limits (set in docker-compose):

deploy:
resources:
limits:
memory: 4G
cpus: '1'
reservations:
memory: 2G

Memory:

  • Limit: 4GB
  • Reservation: 2GB
  • Adjust based on collection size

CPU:

  • Limit: 1 core
  • Increase for better search performance

Configuration Example

Default Configuration

# These are auto-set, no need to configure
QDRANT_URI=http://qdrant:6333
QDRANT_HOST=qdrant
ENABLE_QDRANT_MULTITENANCY_MODE=true
QDRANT_HNSW_M=48

Custom Performance Tuning

# For large datasets
QDRANT_HNSW_M=64
QDRANT_HNSW_EF_CONSTRUCT=200

# For small datasets (save memory)
QDRANT_HNSW_M=16
QDRANT_HNSW_EF_CONSTRUCT=100

Qdrant Management

Access Qdrant Dashboard

Qdrant provides a web UI:

# Access at (if port exposed)
http://localhost:6333/dashboard

Check Qdrant Status

# Check if running
docker compose ps qdrant

# View logs
docker compose logs qdrant

# Check health
curl http://localhost:6333/

List Collections

curl http://localhost:6333/collections

Get Collection Info

curl http://localhost:6333/collections/{collection_name}

Delete Collection

curl -X DELETE http://localhost:6333/collections/{collection_name}

Storage Management

Check Qdrant Storage Size

docker system df -v | grep qdrant

Backup Qdrant Data

# Stop Qdrant
docker compose stop qdrant

# Backup volume
docker run --rm -v chatty-app_qdrant:/data -v $(pwd):/backup ubuntu tar czf /backup/qdrant-backup-$(date +%Y%m%d).tar.gz /data

# Start Qdrant
docker compose start qdrant

Restore Qdrant Data

# Stop Qdrant
docker compose stop qdrant

# Restore volume
docker run --rm -v chatty-app_qdrant:/data -v $(pwd):/backup ubuntu tar xzf /backup/qdrant-backup.tar.gz -C /

# Start Qdrant
docker compose start qdrant

Clear All Collections

⚠️ Warning: This deletes all vector data!

docker compose down
docker volume rm chatty-app_qdrant
docker compose up -d

Troubleshooting

Qdrant Not Starting

Check logs:

docker compose logs qdrant

Common issues:

  • Insufficient memory
  • Corrupted data
  • Port conflicts

Connection Refused

Verify Qdrant is running:

docker compose ps qdrant
curl http://localhost:6333/

Out of Memory

Qdrant uses a lot of memory for large collections. Increase memory limit:

# In docker-compose.yaml
qdrant:
deploy:
resources:
limits:
memory: 8G # Increase from 4G

Slow Search Performance

Tune HNSW parameters:

# Increase M for better recall
QDRANT_HNSW_M=64

# Increase ef_construct for better index
QDRANT_HNSW_EF_CONSTRUCT=200

Collection Errors

Check collection status:

curl http://localhost:6333/collections/{collection_name}

Delete and recreate if corrupted:

curl -X DELETE http://localhost:6333/collections/{collection_name}

Chatty AI will recreate it automatically on next use.


Performance Optimization

For Small Datasets (under 100K vectors)

QDRANT_HNSW_M=16
QDRANT_HNSW_EF_CONSTRUCT=100

Memory: 2GB sufficient

For Medium Datasets (100K-1M vectors)

QDRANT_HNSW_M=32
QDRANT_HNSW_EF_CONSTRUCT=150

Memory: 4GB recommended

For Large Datasets (over 1M vectors)

QDRANT_HNSW_M=64
QDRANT_HNSW_EF_CONSTRUCT=200

Memory: 8GB+ required