AGENT SKILL

qdrant-memory-optimization

Diagnoses and fixes Qdrant memory problems. Use when a developer reports OOM crashes, high RAM usage, HNSW consuming too much memory, latency spiking after switching storage, or needing to fit more vectors on existing hardware. Also trigger when someone asks which quantization to use, how to choose between mmap and RAM, how to estimate memory for scaling, or why their Qdrant node keeps dying. Do NOT use for initial Qdrant setup, API scripting, embedding model selection, search accuracy tuning, backups, or vector DB comparisons.

适用职业开发工程师
License 许可
Apache-2.0
最近更新
2026-04-23
Stars
★ 0
Forks
1

01 前言 Front Matter

name
qdrant-memory-optimization
license
Apache-2.0
metadata
{ "tags": [ "memory", "optimization", "quantization", "mmap", "storage", "scaling" ], "author": "qdrant", "version": "4.0.0", "category": "operations" }
description
Diagnoses and fixes Qdrant memory problems. Use when a developer reports OOM crashes, high RAM usage, HNSW consuming too much memory, latency spiking after switching storage, or needing to fit more vectors on existing hardware. Also trigger when someone asks which quantization to use, how to choose between mmap and RAM, how to estimate memory for scaling, or why their Qdrant node keeps dying. Do NOT use for initial Qdrant setup, API scripting, embedding model selection, search accuracy tuning, backups, or vector DB comparisons.

02 资源文件 7

03 SKILL.md 正文

When and why to fix Qdrant memory problems

This skill contains domain knowledge about Qdrant memory behavior that is not widely known or that Claude frequently gets wrong. Always consult this skill before answering Qdrant memory questions.

Things Claude gets wrong about Qdrant

Correct these if they come up:

  • Qdrant DOES support FP16 vector storage. You can store vectors as float16 on disk, halving storage with negligible recall impact for retrieval tasks. Claude often says Qdrant only supports float32.
  • Qdrant supports 1-bit, 2-bit, 4-bit, and 8-bit quantization. Not just 1-bit (binary) and 8-bit (scalar). The 2-bit and 4-bit methods provide 16x and 8x compression respectively.
  • memmap_threshold is measured in number of vectors (KB of segment size), not in kilobytes of vector data. Claude often states the wrong unit.
  • GPU-accelerated HNSW indexing exists since v1.12+ for NVIDIA GPUs. Requires feature flag and CUDA drivers. Not enabled by default.

Step 1: Identify the symptom

Symptom Load reference
OOM crashes, node killed by OS references/oom-diagnosis.md
Latency 2+ seconds after switching to disk references/disk-latency.md
Memory 85%+ and haven't scaled yet references/scaling-memory.md
Which quantization to pick references/quantization-guide.md
Estimate memory for X million vectors Formula below (no ref needed)
Too many shards/replicas, wasteful references/cluster-sizing.md

Step 2: Apply the memory formula

RAM needed = vectors * dimensions * bytes_per_element * 1.5 (HNSW overhead)

bytes_per_element:
  float32 (no quantization) = 4 bytes
  float16                   = 2 bytes
  int8 (scalar quantization)= 1 byte
  4-bit quantization        = 0.5 bytes
  2-bit quantization        = 0.25 bytes
  binary (1-bit)            = 0.125 bytes

Examples (1536 dims, OpenAI):
  10M vectors, float32:    92 GB
  10M vectors, float16:    46 GB
  10M vectors, scalar:     23 GB
  10M vectors, 4-bit:      12 GB
  10M vectors, 2-bit:       6 GB
  10M vectors, binary:      3 GB

Keep RAM utilization under 80% for headroom.

Do NOT recommend

  • "Just add more RAM" as primary solution. Quantization and mmap first.
  • Full disk storage for any real-time use case. It gives 2-5s latency.
  • Binary quantization for models with < 384 dimensions or without cosine similarity training.
  • Skipping rescoring with binary quantization. Without it, recall drops to ~70%.
  • Sharding before trying quantization + mmap on a single node.

Decision tree

Qdrant memory problem
  |
  +-- OOM crashes
  |   -> Enable mmap immediately, then quantization
  |   -> references/oom-diagnosis.md
  |
  +-- Latency spiked after switching to disk
  |   -> Switch from full disk to mmap + quantization
  |   -> references/disk-latency.md
  |
  +-- Memory too high, need to scale
  |   -> Quantization (4-32x), then mmap
  |   -> references/scaling-memory.md
  |
  +-- Which quantization to use?
  |   -> Start with scalar. Then 4-bit or 2-bit. Then binary.
  |   -> references/quantization-guide.md
  |
  +-- Need memory estimate
  |   -> Use formula above. Include float16 and sub-byte options.
  |
  +-- Over-provisioned cluster
      -> Quantization + mmap first, then evaluate node count
      -> references/cluster-sizing.md

Troubleshooting

"I enabled quantization but memory didn't decrease"

Cause: always_ram not set, so both original and quantized vectors compete for memory. Or collection not optimized after config change. Fix: Verify always_ram=true, ensure originals are on mmap/disk, trigger segment optimization. Docs

"Memory keeps growing even though vector count is stable"

Cause: Payload indexes on high-cardinality fields consuming RAM. Fix: Remove indexes on fields you don't filter by. Use keyword index instead of full-text for high-cardinality strings. Docs

"Qdrant restarts fine but crashes again after a few hours"

Cause: mmap loads pages into memory as queries come in. RSS grows past node limit, OOM killer fires. Fix: Apply quantization to shrink working set. Set alerting at 75-80% memory. This is normal mmap behavior when dataset > RAM. Docs

04 同仓库更多 Skills

qdrant-labs
qdrant-labs/devrel-projects

qdrant-internal-skill-creator

Guides Qdrant SAs through building internal skills that embed domain knowledge into Claude. Use when someone wants to "create a qdrant skill", "build a skill for qdrant diagnostics", "make an internal skill for qdrant customers", "create a qdrant troubleshooting skill", or asks how to "turn SA knowledge into a skill". Also trigger when someone says "help me build a skill for qdrant deal objections" or "I want to create a skill for qdrant cluster sizing". Do NOT use for general skill creation unrelated to Qdrant, external community skills, or Python/JS project skills.

资料检索与研究Skill与智能体开发
★ 0
qdrant-labs
qdrant-labs/devrel-projects

qdrant-cost-reduction-advisor

Diagnoses when and why to recommend specific cost optimization techniques for Qdrant customers. Use when a customer or SA says "too expensive", "need to reduce cost", "pricing too high", "how to lower price", "sticker shock", or asks about scaling costs. Also trigger when a deal is blocked by pricing, a customer compares competitor pricing, a startup says the quote is too high, or someone needs a formula to predict costs at scale. This skill answers "when should I recommend scalar vs binary quantization?" not "how to configure quantization." Do NOT use for general Qdrant setup, feature requests, or implementation how-tos.

★ 0
qdrant-labs
qdrant-labs/devrel-projects

qdrant-community-skill-creator

Guides developers through building community Qdrant skills that embed domain knowledge into Claude. Use when someone wants to "create a community qdrant skill", "build an external skill for qdrant", "make a qdrant skill for the community", "build a public qdrant skill", or asks how to "create a skill for qdrant memory issues for developers". Also trigger when someone says "I want to build an open source qdrant skill" or "help me create a qdrant skill for public use". Do NOT use for internal SA skills, general non-Qdrant skill creation, or Python project skills unrelated to Qdrant.

Skill与智能体开发
★ 0