Skip to content
Vector database engineering on Kubernetes · Chapter 10 of 20 Day 9: Capacity and scaling – reading room, closed stacks and a new branch

Day 9: Capacity and scaling – reading room, closed stacks and a new branch

Goal: calculate and verify how much memory a vector needs, understand where this memory sits in the pod, experience what a memory limit that is too tight does – first slow motion, then OOMKilled –, add a fourth Qdrant node, move a shard and cleanly remove a node again · Duration: about 150 min · Prerequisite: Day 0 to Day 8

State before this chapter

Three Qdrant pods are running, one each on vdb2, vdb3 and vdb4.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected (your IPs and ages will differ):

NAME       READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running   0          10h   10.42.1.34   vdb2   <none>           <none>
qdrant-1   1/1     Running   0          10h   10.42.3.21   vdb4   <none>           <none>
qdrant-2   1/1     Running   0          10h   10.42.2.6    vdb3   <none>           <none>
# on vdb1
curl -s http://10.43.151.237:6333/collections

Expected:

{"result":{"collections":[{"name":"doku"},{"name":"glove"},{"name":"verteilt"}]},"status":"ok","time":0.000598074}

glove from Day 8 has 1,183,514 vectors with 100 dimensions in three shards without a second copy, HNSW with m 16 and ef_construct 100, and int8 scalar quantization. Today you do your calculations on it. Each Qdrant pod has a memory limit of 2 Gi and requests 1 Gi (Day 2). You keep using the load generator last-prozesse.py and the questions glove-fragen.npy from Day 8; they are in ~/labor/tag08.

Introduction

“How much memory does our vector database need?” is the first question of any capacity planning – and the answer “as much as the vectors” is only half right. Qdrant stores vectors, index and quantized version in files and maps them into memory. The kernel counts these pages toward the pod, but may release them again at any time. A memory limit that is too tight therefore does not lead to a crash right away, but first to something more insidious: the database keeps running, only a hundred times slower.

The second question is: “What do we do when there isn’t enough room?” Another pod is quickly started. But a new Qdrant node does not get any data on its own, and a node that disappears takes its shards with it. That is why you don’t scale a vector database with an autoscaler, but by hand and in steps that you verify.

Today you will learn:

  • to calculate the memory requirement of a collection and verify it against the files of a shard,
  • to distinguish in the pod what is real working memory (anon) and what is a mapped file (file),
  • why a limit that is too small first makes things slow, and only an even smaller one leads to OOMKilled,
  • how an OOMKilled during a rollout turned into an outage of two pods,
  • to add a fourth node, move a shard and cleanly remove the node again,
  • why a HorizontalPodAutoscaler is the wrong tool for Qdrant.

Background

The picture of the day: reading room and closed stacks

Every branch of the city library has two rooms for its books.

  • In the closed stacks in the basement stand the entire holdings – that is the Longhorn volume. Nothing gets lost there, but it is a long way down.
  • In the reading room, the books currently needed lie ready on the tables – that is the working memory. Qdrant does not fetch books from the closed stacks one by one, but maps in whole shelves (mmap): when a page is needed, a messenger fetches it from the basement and puts it on a table.
  • Next to the books lie the librarians’ notes on the tables: routing slips, open requests, lists. These exist only in the reading room, not in the closed stacks – that is the anonymous memory (anon).
  • The memory limit is the number of tables. When it gets tight, the caretaker first puts books back in the closed stacks – they can be fetched again, after all. If the reading room is so small that the messengers are running non-stop, lending almost comes to a standstill (thrashing).
  • If not even the librarians’ notes fit into the room anymore, the caretaker closes the building: OOMKilled.
  • A new branch opens with empty shelves. It only gets holdings once you move a shelf section there (moving a shard). Whoever closes a branch without moving things out first locks its shelf section away.

The terms

Term Meaning In the picture
mmap a file is mapped into the address space, the kernel loads pages on demand shelf from the closed stacks, messenger fetches pages
Page cache (file) mapped file pages in RAM, releasable books on the tables
anon memory without a file behind it, not releasable without swap the librarians’ notes
Working set what kubectl top shows: used memory minus inactive file pages what is currently needed on the tables
Major fault a page is missing from RAM and must be read from the storage device a messenger trip to the basement
OOMKilled the kernel terminates the container because the limit is no longer enough caretaker closes the building
Peer a member of the Qdrant cluster with its own peer_id branch building
move_shard move a shard with all its points to another peer move a shelf section
Resharding change the number of shards of a collection afterwards re-divide the shelf sections

Remember: with Qdrant, most of the memory is borrowed closed stacks, not fixed property. A limit below the need for file pages makes things slow, a limit below the anonymous memory makes them dead.

Drill 1: What a vector costs

Where you are: on vdb1.

What you have afterwards: a calculation of the memory requirement of glove and the comparison with the files of a real shard.

Step 1 – create the working folder.

# on vdb1
mkdir -p ~/labor/tag09

Step 2 – ask how many points are in a shard. You ask the pod qdrant-2 directly at its pod IP, not through the Service – that way exactly the peer whose files you will look at shortly answers.

# on vdb1
curl -s http://10.42.2.6:6333/collections/glove/cluster
  • 10.42.2.6 is the IP of qdrant-2 from kubectl get pods -o wide – insert yours.
  • /collections/glove/cluster shows which shards this peer holds itself (local_shards) and where the others are (remote_shards).

Expected:

{"result":{"peer_id":1485700002748332,"shard_count":3,"local_shards":[{"shard_id":2,"points_count":392053,"state":"Active"}],"remote_shards":[{"shard_id":0,"peer_id":857928665674298,"state":"Active"},{"shard_id":1,"peer_id":121400021250061,"state":"Active"}],"shard_transfers":[]},"status":"ok","time":0.001476499}

qdrant-2 holds shard 2 with 392,053 points.

Step 3 – calculate the space for the vectors. Each component is a 32-bit floating-point number, that is, 4 bytes. A point with 100 dimensions needs 400 bytes.

# on vdb1
python3 -c 'print(392053 * 100 * 4 / 2**20)'
  • python3 -c '…' runs the line as a Python program.
  • 392053 * 100 * 4 is points × dimensions × 4 bytes.
  • / 2**20 converts to MiB.

Expected:

149.5563507080078

About 150 MiB of pure vector data for this shard.

Step 4 – check what is on the volume.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- du -sh /qdrant/storage/collections/glove/2/segments
  • exec qdrant-2 -c qdrant -- runs the command in the container qdrant of the pod.
  • du -sh adds up the space used by a folder (-s) and prints it in readable form (-h).
  • glove/2/segments are the segments of shard 2.

Expected:

222M    /qdrant/storage/collections/glove/2/segments

222 MiB instead of 150 – the rest is index and quantized version. Which files these are, you can see in the largest segment.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- ls /qdrant/storage/collections/glove/2/segments

Expected:

80c520f2-5f8f-4c6d-9101-85fe1970fa37
de067815-84a5-43a3-8e3f-6a2991d2ab10

Step 5 – measure the four large files. Insert the name of your large segment.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- du -h /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/vector_storage/matrix.dat /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/vector_storage/quantized.data /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/vector_index/links_compressed.bin /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/id_tracker.mappings

Expected:

150M    /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/vector_storage/matrix.dat
44M /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/vector_storage/quantized.data
22M /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/vector_index/links_compressed.bin
4.9M    /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/id_tracker.mappings
File Size Per point Content
matrix.dat 150M 400 bytes the original vectors – exactly your calculation
quantized.data 44M about 118 bytes the int8 version from Day 8, a bit more than 100 bytes per point
links_compressed.bin 22M about 59 bytes the HNSW graph, stored compressed
id_tracker.mappings 4.9M about 13 bytes mapping of point IDs to internal numbers

Step 6 – check how Qdrant holds the vectors.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- cat /qdrant/storage/collections/glove/2/segments/de067815-84a5-43a3-8e3f-6a2991d2ab10/segment.json

Expected:

{"initial_version":1184,"version":1184,"config":{"vector_data":{"":{"size":100,"distance":"Cosine","storage_type":"InRamMmap","index":{"type":"hnsw","options":{"m":16,"ef_construct":100,"full_scan_threshold":10000,"max_indexing_threads":0,"on_disk":false}},"quantization_config":{"scalar":{"type":"int8","quantile":0.99,"always_ram":true}}}},"payload_storage_type":{"type":"mmap"}}}

"storage_type":"InRamMmap": the vectors are in a file that is mapped into memory – with Qdrant, “in RAM” means “mapped and in the page cache”, not “on the program’s heap”. This becomes important in Drill 2.

What you make of it – the rule of thumb. For planning, the Qdrant documentation calculates with points × dimensions × 4 bytes × 1.5. For all of glove: 1,183,514 × 100 × 4 × 1.5 ≈ 710 MB. Extrapolated from shard 2 (222 MiB for 392,053 points), the volumes hold about 670 MiB in total – the rule of thumb fits. For doku with 768 dimensions, each point would be almost eight times as expensive.

Remember: memory per vector = dimensions × 4 bytes, plus about half again for index and management. If you quantize and still keep the originals in RAM, you add a bit more – Day 8 measured it.

Save your progress? Sign up for free

Drill 2: Where the memory sits in the pod

Where you are: on vdb1.

What you have afterwards: the split of pod memory into notes (anon) and books on the tables (file), and the explanation for the number in kubectl top.

A container is a cgroup. The kernel keeps accounts of the memory of each cgroup, and the container can read these accounts itself under /sys/fs/cgroup.

Step 1 – read used memory and limit.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- cat /sys/fs/cgroup/memory.current /sys/fs/cgroup/memory.max
  • memory.current is everything the cgroup is currently using, in bytes.
  • memory.max is the limit – here the 2 Gi from the values file.

Expected:

486936576
2147483648

464 MiB used, 2 GiB allowed.

Step 2 – read the split.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- grep -E '^(anon|file|active_file|inactive_file) ' /sys/fs/cgroup/memory.stat
  • grep -E searches with an extended regular expression.
  • '^(anon|file|active_file|inactive_file) ' takes only the four lines that begin with these names.
  • memory.stat is the detailed accounting of the cgroup, about 40 lines.

Expected:

anon 93687808
file 382369792
inactive_file 170221568
active_file 212148224
Line Value Meaning
anon 89 MiB heap and stacks of Qdrant – the librarians’ notes
file 365 MiB mapped files in the page cache – books on the tables
active_file 202 MiB file pages that were recently needed several times
inactive_file 162 MiB file pages that the kernel puts back into the closed stacks first

Four fifths of the pod’s memory are mapped files.

Step 3 – compare with kubectl top.

# on vdb1
kubectl -n qdrant top pods

Expected:

NAME       CPU(cores)   MEMORY(bytes)   
qdrant-0   24m          456Mi           
qdrant-1   22m          367Mi           
qdrant-2   30m          301Mi           

kubectl top shows 301 Mi for qdrant-2, not 464. It shows the working set: memory.current minus inactive_file, that is, 486,936,576 − 170,221,568 bytes = 302 MiB. It does not count the inactive file pages, because the kernel can release them without further ado.

Remember: kubectl top shows what is currently needed on the tables, not what a database needs to work fast. For Qdrant you have to look in memory.stat: anon is the lower bound, anon plus the frequently read part of file is the requirement.

Save your progress? Sign up for free

Drill 3: The reading room shrinks

Where you are: on vdb1, measurements in ~/labor/tag08, the values file in ~/labor/tag09.

What you have afterwards: measured what a memory limit of 256 Mi and of 128 Mi does to search.

Step 1 – measure the response time beforehand. As on Day 8: 16 processes, 8000 requests, default ef.

# on vdb1
cd ~/labor/tag08
# on vdb1
~/werkbank/bin/python last-prozesse.py http://10.43.151.237:6333 glove glove-fragen.npy 16 8000

Expected (two runs in a row):

parallel 16 (Prozesse) · 8000 Anfragen in 24.8 s · 322 Anfragen/s · p50 38.3 ms · p95 80.2 ms · p99 107.9 ms · max 158.2 ms · Fehler 0
parallel 16 (Prozesse) · 8000 Anfragen in 23.4 s · 342 Anfragen/s · p50 37.8 ms · p95 73.0 ms · p99 94.0 ms · max 179.8 ms · Fehler 0

Step 2 – fetch the values file from Day 6.

# on vdb1
cp ~/labor/tag06/qdrant-werte.yaml ~/labor/tag09/
# on vdb1
cd ~/labor/tag09

Step 3 – lower the limit to 256 Mi. The request (requests) has to come down too, because it must not be larger than the limit.

# on vdb1
nano qdrant-werte.yaml
~/labor/tag09/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 3

nodeSelector:
  vdb-rolle: daten

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: qdrant
        topologyKey: kubernetes.io/hostname

resources:
  requests:
    cpu: 500m
    memory: 256Mi
  limits:
    memory: 256Mi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true

podDisruptionBudget:
  enabled: true
  maxUnavailable: 1
  • requests.memory: 256Mi – this is how much the scheduler reserves on the node.
  • limits.memory: 256Mi – the cgroup may not use more than this; it becomes memory.max.

Step 4 – roll out.

# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
NAME: qdrant
LAST DEPLOYED: Sat Dec  5 23:06:44 2026
NAMESPACE: qdrant
STATUS: deployed
REVISION: 7
# on vdb1
kubectl -n qdrant rollout status statefulset/qdrant --timeout=300s

Expected (excerpt, after a good two and a half minutes):

Waiting for partitioned roll out to finish: 0 out of 3 new pods have been updated...
Waiting for 1 pods to be ready...
Waiting for partitioned roll out to finish: 1 out of 3 new pods have been updated...
Waiting for 1 pods to be ready...
Waiting for partitioned roll out to finish: 2 out of 3 new pods have been updated...
Waiting for 1 pods to be ready...
partitioned roll out complete: 3 new pods have been updated...

The pods are replaced one at a time, qdrant-2 first, and only when a new pod is ready is the next one replaced.

Step 5 – look at the memory.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- grep -E '^(anon|file|active_file|inactive_file) ' /sys/fs/cgroup/memory.stat

Expected:

anon 77205504
file 184147968
inactive_file 14938112
active_file 169209856

The notes (anon, 74 MiB) fit; 176 MiB remain for books instead of 365 before. The kernel has put almost all inactive pages back into the closed stacks.

Step 6 – measure the response time with 256 Mi.

# on vdb1
cd ~/labor/tag08
# on vdb1
~/werkbank/bin/python last-prozesse.py http://10.43.151.237:6333 glove glove-fragen.npy 16 8000

Expected (two runs):

parallel 16 (Prozesse) · 8000 Anfragen in 24.6 s · 326 Anfragen/s · p50 38.5 ms · p95 76.6 ms · p99 108.0 ms · max 654.6 ms · Fehler 0
parallel 16 (Prozesse) · 8000 Anfragen in 23.3 s · 343 Anfragen/s · p50 36.5 ms · p95 70.2 ms · p99 93.5 ms · max 157.1 ms · Fehler 0

No difference except a single outlier in the first run (max 654 ms – pages that had to be fetched again first). Search needs the quantized version and the graph constantly, the original vectors only for looking up the best candidates (rescore). For shard 2 that is 44 + 22 MiB plus a small part of matrix.dat – that fits into 176 MiB.

Step 7 – lower the limit to 128 Mi. Change both lines in the values file to 128Mi.

# on vdb1
cd ~/labor/tag09
# on vdb1
nano qdrant-werte.yaml
~/labor/tag09/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 3

nodeSelector:
  vdb-rolle: daten

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: qdrant
        topologyKey: kubernetes.io/hostname

resources:
  requests:
    cpu: 500m
    memory: 128Mi
  limits:
    memory: 128Mi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true

podDisruptionBudget:
  enabled: true
  maxUnavailable: 1
# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
LAST DEPLOYED: Sat Dec  5 23:10:47 2026
STATUS: deployed
REVISION: 8
# on vdb1
kubectl -n qdrant rollout status statefulset/qdrant --timeout=300s

Expected (last line):

partitioned roll out complete: 3 new pods have been updated...

All three pods start and become ready – Qdrant comes up with 128 Mi.

# on vdb1
kubectl -n qdrant exec qdrant-2 -c qdrant -- grep -E '^(anon|file|active_file|inactive_file) ' /sys/fs/cgroup/memory.stat

Expected:

anon 77402112
file 49897472
inactive_file 9588736
active_file 40308736

48 MiB remain for books – less than the quantized version and graph of shard 2 together (66 MiB).

Step 8 – measure the response time with 128 Mi. Only 400 requests instead of 8000 – you will see why shortly.

# on vdb1, Terminal 1
cd ~/labor/tag08
# on vdb1, Terminal 1
~/werkbank/bin/python last-prozesse.py http://10.43.151.237:6333 glove glove-fragen.npy 16 400

While the run is working, look at the pods and at the node vdb2 in a second terminal; qdrant-0 with the largest glove shard runs there.

# on vdb1, Terminal 2
kubectl -n qdrant top pods

Expected:

NAME       CPU(cores)   MEMORY(bytes)   
qdrant-0   74m          123Mi           
qdrant-1   46m          94Mi            
qdrant-2   77m          123Mi           

Hardly any CPU – Qdrant is not computing, Qdrant is waiting.

# on vdb2
vmstat 5 2
  • vmstat shows processes, memory, input/output and CPU of the whole node.
  • 5 2 means: two measurements five seconds apart. The first line is the average since boot, the second shows the last five seconds.

Expected:

procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu-------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st gu
14 31      0 5902128 151400 9537188    0    0   526   285 5571    8  3  3 92  0  2  0
 8 34      0 5910464 151400 9537088    0    0 40035   182 28654 43242 12 32  1 27 28  0
Column Value (second line) Meaning
b 34 processes waiting for input/output – normal is 0 to 1
bi 40035 KiB read per second, about 40 MB/s from the Longhorn volume
free 5910464 5.6 GiB free on the node – the node has room, only the pod doesn’t
wa 27 percent of CPU time spent waiting for the storage device
sy 32 percent in the kernel – page faults and Longhorn traffic

And the result in terminal 1:

parallel 16 (Prozesse) · 400 Anfragen in 99.7 s · 4 Anfragen/s · p50 3937.6 ms · p95 4813.6 ms · p99 5200.6 ms · max 5514.9 ms · Fehler 0

4 requests/s instead of 342, median 3.9 s instead of 38 ms. No error, no restart, all pods Running and ready. We had also started the same run with 8000 requests beforehand: it took 1925 s, that is, a good 32 minutes, at 4 requests/s and p50 3852 ms.

Step 9 – count the messenger trips.

# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- grep -E '^(anon|file|workingset_refault_file|pgmajfault) ' /sys/fs/cgroup/memory.stat
  • workingset_refault_file counts file pages that had to be fetched although they had been in memory shortly before.
  • pgmajfault counts page faults where the storage device was read.

Expected (for us after the long run with 8000 requests – the counters grow with every run):

anon 121257984
file 2842624
workingset_refault_file 14685493
pgmajfault 4139316

Under load, the notes of qdrant-0 grew to 116 MiB, leaving 2.7 MiB for books. More than 14 million times a page was fetched that had only just been put back.

Remember: a limit that is too tight does not make Qdrant crash, but work from the closed stacks: a hundred times slower, without a single error, with green probes. The warning signs are b and wa in vmstat and a rising workingset_refault_file, not the number of restarts.

Save your progress? Sign up for free

Drill 4: Too small for its own notes – OOMKilled

Where you are: on vdb1, in ~/labor/tag09.

What you have afterwards: experienced a real OOMKilled and seen how it turned into an outage of two pods – and got the collection back afterwards without loss.

Step 1 – lower the limit below the anonymous memory. A pod’s notes were at 74 to 116 MiB. With 64 Mi they no longer fit.

# on vdb1
cd ~/labor/tag09
# on vdb1
nano qdrant-werte.yaml
~/labor/tag09/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 3

nodeSelector:
  vdb-rolle: daten

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: qdrant
        topologyKey: kubernetes.io/hostname

resources:
  requests:
    cpu: 500m
    memory: 64Mi
  limits:
    memory: 64Mi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true

podDisruptionBudget:
  enabled: true
  maxUnavailable: 1

Step 2 – roll out and watch.

# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
LAST DEPLOYED: Sat Dec  5 23:47:37 2026
STATUS: deployed
REVISION: 9

Helm reports success – Helm only checks whether Kubernetes has accepted the objects, not whether the pods are running.

# on vdb1
kubectl -n qdrant rollout status statefulset/qdrant --timeout=150s
  • --timeout=150s aborts the waiting after two and a half minutes.

Expected:

Waiting for partitioned roll out to finish: 0 out of 3 new pods have been updated...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
error: timed out waiting for the condition
# on vdb1
kubectl -n qdrant get pods

Expected:

NAME       READY   STATUS             RESTARTS     AGE
qdrant-0   1/1     Running            0            37m
qdrant-1   1/1     Running            0            38m
qdrant-2   0/1     CrashLoopBackOff   3 (8s ago)   2m29s

The rollout is stuck at the first pod. qdrant-0 and qdrant-1 are still running with 128 Mi from Drill 3.

Step 3 – read the reason.

# on vdb1
kubectl -n qdrant describe pod qdrant-2

Expected (excerpt – the section of the container qdrant):

    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       OOMKilled
      Exit Code:    137
      Started:      Sat, 05 Dec 2026 23:49:45 +0000
      Finished:     Sat, 05 Dec 2026 23:50:04 +0000
    Ready:          False
    Restart Count:  3
    Limits:
      memory:  64Mi

OOMKilled, exit code 137 (128 + signal 9, SIGKILL), 19 seconds after the start.

# on vdb1
kubectl -n qdrant logs qdrant-2 -c qdrant --previous --tail=8
  • --previous shows the log of the crashed run, not the current one.
  • --tail=8 only the last eight lines.

Expected (excerpt, the last lines):

2026-12-05T23:49:45.551662Z  INFO storage::content_manager::consensus::persistent: Loading raft state from ./storage/raft_state.json
2026-12-05T23:49:45.570362Z  INFO storage::content_manager::toc: Loading collection: glove

The log ends in the middle of loading glove – without an error message. A process terminated with SIGKILL cannot write anything anymore. The trail is in the node’s kernel log.

# on vdb3
sudo journalctl -k --since '-10 min' --grep 'Memory cgroup out of memory' --no-pager
  • -k only kernel messages.
  • --since '-10 min' only the last ten minutes.
  • --grep '…' only lines with this text.
  • --no-pager prints everything directly.

Expected (excerpt, the first line):

Dec 05 23:48:20 vdb3 kernel: Memory cgroup out of memory: Killed process 2725423 (qdrant) total-vm:858892kB, anon-rss:63092kB, file-rss:22532kB, shmem-rss:0kB, UID:1000 pgtables:872kB oom_score_adj:992

anon-rss:63092kB – the notes alone had reached the 64 Mi limit. The kernel could have released the file pages (file-rss), but not the notes.

Step 4 – what the readers notice. glove has no second copies: shard 2 was only on qdrant-2.

# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/glove/points/count -H 'Content-Type: application/json' -d '{"exact":true}'
  • points/count counts points.
  • "exact":true really counts every point in every shard instead of estimating.

Expected: no output – curl ends with exit code 52 (“Empty reply from server”). The connection was dropped in the middle of the request.

We immediately asked the same request again, this time with the status code:

# on vdb1
curl -s -w ' HTTP %{http_code} nach %{time_total} s\n' -X POST http://10.43.151.237:6333/collections/glove/points/count -H 'Content-Type: application/json' -d '{"exact":true}'
  • -w '…' prints the status code and total time after the response.

Expected:

{"status":{"error":"Service internal error: 1 of 1 read operations failed:\n  Service internal error: Tonic status error: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-0.qdrant-headless:6335/, error: transport error\""},"time":0.450735551} HTTP 500

It is not qdrant-2, but qdrant-0 that cannot be reached. A look at the pods:

# on vdb1
kubectl -n qdrant get pods

Expected:

NAME       READY   STATUS             RESTARTS      AGE
qdrant-0   0/1     Running            0             18s
qdrant-1   1/1     Running            0             39m
qdrant-2   0/1     CrashLoopBackOff   3 (48s ago)   3m9s

Step 5 – find out what happened to qdrant-0. qdrant-0 was running with 128 Mi on vdb2.

# on vdb2
sudo journalctl -k --since '-15 min' --grep 'Memory cgroup out of memory' --no-pager

Expected (excerpt):

Dec 05 23:50:29 vdb2 kernel: Memory cgroup out of memory: Killed process 1886433 (qdrant) total-vm:2733152kB, anon-rss:124956kB, file-rss:38676kB, shmem-rss:0kB, UID:1000 pgtables:2252kB oom_score_adj:993
Dec 05 23:50:29 vdb2 kernel: Memory cgroup out of memory: Killed process 1923855 (search-io-65) total-vm:2733152kB, anon-rss:124956kB, file-rss:38676kB, shmem-rss:0kB, UID:1000 pgtables:2252kB oom_score_adj:993

At 23:50:29 – exactly at your count request, and the second killed thread is called search-io-65. The exact count over the 424,230 points of shard 1 made the notes of qdrant-0 grow to 122 MiB, up to the 128 Mi limit. Your read request killed the second pod.

And then it got worse:

# on vdb1
kubectl -n qdrant get pod qdrant-0 -o jsonpath='{.spec.containers[0].resources}'
  • -o jsonpath='{…}' outputs only the specified field, here the resources of the first container.

Expected:

{"limits":{"memory":"64Mi"},"requests":{"cpu":"500m","memory":"64Mi"}}

RESTARTS 0, AGE 18s and 64 Mi: the StatefulSet controller did not restart the crashed qdrant-0 with the old setting, but replaced it with a pod of the new revision – with the limit at which qdrant-2 is currently failing. Two of three pods cannot start.

Step 6 – the library council.

# on vdb1
curl -s http://10.43.151.237:6333/cluster

Expected (look for raft_info and message_send_failures):

{"result":{"status":"enabled","peer_id":857928665674298,"peers":{"857928665674298":{"uri":"http://qdrant-1.qdrant-headless:6335/"},"121400021250061":{"uri":"http://qdrant-0.qdrant-headless:6335/"},"1485700002748332":{"uri":"http://qdrant-2.qdrant-headless:6335/"}},"raft_info":{"term":210,"commit":132,"pending_operations":0,"leader":857928665674298,"role":"Leader","is_voter":true},"consensus_thread_status":{"consensus_thread_status":"working","last_update":"2026-12-05T23:51:06.454580981Z"},"message_send_failures":{"http://qdrant-0.qdrant-headless:6335/":{"count":181,"latest_error":"Error in closure supplied to transport channel pool: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-0.qdrant-headless:6335/, error: transport error\"","latest_error_timestamp":"2026-12-05T23:51:06.470470431Z"},"http://qdrant-2.qdrant-headless:6335/":{"count":1008,"latest_error":"Error in closure supplied to transport channel pool: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-2.qdrant-headless:6335/, error: transport error\"","latest_error_timestamp":"2026-12-05T23:51:06.470499698Z"}}},"status":"ok","time":0.00016857}

qdrant-1 is leader, but reaches neither of the other two members. With one of three members, the council is not quorate (Day 7) – now things have to move fast.

Step 7 – reset the limit. The unchanged file from Day 6 is the safe version.

# on vdb1
cp ~/labor/tag06/qdrant-werte.yaml ~/labor/tag09/
# on vdb1
date +%T

Expected:

23:51:14
# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
LAST DEPLOYED: Sat Dec  5 23:51:15 2026
STATUS: deployed
REVISION: 10
# on vdb1
kubectl -n qdrant rollout status statefulset/qdrant --timeout=240s

Expected (excerpt):

Waiting for 2 pods to be ready...
Waiting for 1 pods to be ready...
Waiting for partitioned roll out to finish: 2 out of 3 new pods have been updated...
Waiting for 1 pods to be ready...
partitioned roll out complete: 3 new pods have been updated...
# on vdb1
date +%T

Expected:

23:53:32

A good two minutes until all three pods are ready again. The controller replaced the two broken pods immediately, without waiting for the first one.

Step 8 – check whether anything is missing.

# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/glove/points/count -H 'Content-Type: application/json' -d '{"exact":true}'

Expected:

{"result":{"count":1183514},"status":"ok","time":0.258549044}

All 1,183,514 points are there, doku and verteilt count 13,220 each. An OOMKilled loses no data that had already been confirmed – it is in the WAL and in the segments on the volume.

# on vdb1
kubectl -n qdrant get pods -o wide

Expected (excerpt, the columns NAME and NODE):

NAME       NODE
qdrant-0   vdb3
qdrant-1   vdb4
qdrant-2   vdb2

qdrant-0 and qdrant-2 swapped nodes in the process: both were rescheduled at the same time, the anti-affinity only demands different nodes, and the Longhorn volumes moved along.

Step 9 – the collection after the restart.

# on vdb1
curl -s http://10.43.151.237:6333/collections/glove -o g.json
# on vdb1
jq -c '.result|{status,optimizer_status,points_count,indexed_vectors_count,segments_count}' g.json

Expected:

{"status":"grey","optimizer_status":"ok","points_count":1183514,"indexed_vectors_count":1166917,"segments_count":8}

grey means: optimizations are pending, but have not yet been triggered after the restart. Qdrant only starts them on the next change. The measurement afterwards was correspondingly weak: 271 requests/s, p99 114 ms. An empty update of the optimizer settings triggers them:

# on vdb1
curl -s -X PATCH http://10.43.151.237:6333/collections/glove -H 'Content-Type: application/json' -d '{"optimizers_config":{}}'
  • "optimizers_config":{} changes nothing in the settings, but counts as a change.

Expected:

{"result":true,"status":"ok","time":0.23459988}

Repeat the two commands from Step 9 until status shows green – for us after just under two minutes:

{"status":"green","optimizer_status":"ok","points_count":1183514,"indexed_vectors_count":1183514,"segments_count":6}

Now indexed_vectors_count equals points_count: the 16,597 points from small segments that had remained without an index on Day 8 are now in the HNSW graph too.

# on vdb1
cd ~/labor/tag08
# on vdb1
~/werkbank/bin/python last-prozesse.py http://10.43.151.237:6333 glove glove-fragen.npy 16 8000

Expected:

parallel 16 (Prozesse) · 8000 Anfragen in 18.5 s · 433 Anfragen/s · p50 30.9 ms · p95 59.8 ms · p99 77.2 ms · max 162.4 ms · Fehler 0

433 requests/s – more than before the chapter, because now all points are in the index.

Remember: you recognize OOMKilled by exit code 137 and in the kernel log, not in the application log. Never change a limit into the unknown for all pods at once: a pod that dies for another reason comes back with the new, broken setting.

Save your progress? Sign up for free

Drill 5: A new branch – the fourth node

Where you are: on vdb1, in ~/labor/tag09.

What you have afterwards: a fourth Qdrant pod on vdb1 – and proof that it stays empty.

There is no fifth machine in the lab. vdb1 is the k3s server and workbench and has room with 12 vCPU and 12 GB. For this drill, vdb1 gets the data node label. In production this would be a separate machine – on vdb1 the new pod shares the CPU with the load generator.

Step 1 – mark vdb1 as a data node.

# on vdb1
kubectl label node vdb1 vdb-rolle=daten

Expected:

node/vdb1 labeled

Step 2 – four pods in the values file.

# on vdb1
cd ~/labor/tag09
# on vdb1
nano qdrant-werte.yaml
~/labor/tag09/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 4

nodeSelector:
  vdb-rolle: daten

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: qdrant
        topologyKey: kubernetes.io/hostname

resources:
  requests:
    cpu: 500m
    memory: 1Gi
  limits:
    memory: 2Gi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true

podDisruptionBudget:
  enabled: true
  maxUnavailable: 1

Step 3 – roll out.

# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected:

level=WARN msg="upgrade failed" name=qdrant error="conflict occurred while applying object qdrant/qdrant apps/v1, Kind=StatefulSet: Apply failed with 1 conflict: conflict with \"kubectl\" with subresource \"scale\" using apps/v1: .spec.replicas"
Error: UPGRADE FAILED: conflict occurred while applying object qdrant/qdrant apps/v1, Kind=StatefulSet: Apply failed with 1 conflict: conflict with "kubectl" with subresource "scale" using apps/v1: .spec.replicas

A conflict from Day 6: there you once set the StatefulSet to four pods with kubectl scale and back to three. Since then, the field .spec.replicas belongs to the manager kubectl. Helm 4 applies objects on the server side (server-side apply) and does not overwrite a field that belongs to another manager – as long as it wants to set the same value, you notice nothing, as with all upgrades until now. Now it wants to set a different value and aborts.

Step 4 – let Helm take over the field.

# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml --force-conflicts
  • --force-conflicts lets Helm take over fields that belong to another manager. After that, .spec.replicas belongs to Helm again.

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
LAST DEPLOYED: Sat Dec  5 23:58:41 2026
STATUS: deployed
REVISION: 12

Revision 12, not 11 – the failed upgrade also got a revision.

# on vdb1
kubectl -n qdrant rollout status statefulset/qdrant --timeout=300s

Expected:

Waiting for 1 pods to be ready...
partitioned roll out complete: 4 new pods have been updated...
# on vdb1
kubectl -n qdrant get pods -o wide

Expected:

NAME       READY   STATUS    RESTARTS   AGE     IP           NODE   NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running   0          8m8s    10.42.2.10   vdb3   <none>           <none>
qdrant-1   1/1     Running   0          6m51s   10.42.3.24   vdb4   <none>           <none>
qdrant-2   1/1     Running   0          8m8s    10.42.1.38   vdb2   <none>           <none>
qdrant-3   1/1     Running   0          46s     10.42.0.21   vdb1   <none>           <none>

After 50 seconds, qdrant-3 is running on vdb1. The other pods were not touched.

Step 5 – ask the council. This time directly at the new pod.

# on vdb1
curl -s http://10.42.0.21:6333/cluster | jq -c '.result|{peer_id,peers,raft_info}'
  • | jq -c '…' shows only peer_id, the list of members and the Raft state – a filter that is part of the learning material here.

Expected:

{"peer_id":7532708151186215,"peers":{"121400021250061":{"uri":"http://qdrant-0.qdrant-headless:6335/"},"1485700002748332":{"uri":"http://qdrant-2.qdrant-headless:6335/"},"857928665674298":{"uri":"http://qdrant-1.qdrant-headless:6335/"},"7532708151186215":{"uri":"http://qdrant-3.qdrant-headless:6335/"}},"raft_info":{"term":211,"commit":137,"pending_operations":0,"leader":1485700002748332,"role":"Follower","is_voter":true}}

Four members; qdrant-3 is a voting follower with the peer_id 7532708151186215.

Step 6 – check what the new branch has on its shelves.

# on vdb1
curl -s http://10.42.0.21:6333/collections/glove/cluster

Expected:

{"result":{"peer_id":7532708151186215,"shard_count":3,"local_shards":[],"remote_shards":[{"shard_id":0,"peer_id":857928665674298,"state":"Active"},{"shard_id":1,"peer_id":121400021250061,"state":"Active"},{"shard_id":2,"peer_id":1485700002748332,"state":"Active"}],"shard_transfers":[]},"status":"ok","time":0.000270881}

"local_shards":[] – nothing. Qdrant does not redistribute existing shards on its own.

# on vdb1
kubectl -n qdrant top pods

Expected:

NAME       CPU(cores)   MEMORY(bytes)   
qdrant-0   24m          413Mi           
qdrant-1   25m          486Mi           
qdrant-2   44m          463Mi           
qdrant-3   98m          61Mi            

61 Mi – an empty Qdrant. The new pod takes neither memory nor work off the others.

Remember: a new Qdrant pod is a branch with empty shelves. More pods only mean more capacity once you move shards there – or create new collections with enough shards.

Save your progress? Sign up for free

Drill 6: Moving a shelf section

Where you are: on vdb1.

What you have afterwards: shard 1 of glove on the new node, the duration of the move and the answer to the question of whether the number of shards can be changed afterwards.

Shard 1 is the largest shard of glove (424,230 points) and is on qdrant-0 – since Drill 4 on vdb3 with 2 vCPU. It moves to vdb1. The peer_id of qdrant-0 (121400021250061) is listed at shard_id 1 in Step 6 of Drill 5.

Step 1 – trigger the move.

# on vdb1
date +%T

Expected:

23:59:46
# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/glove/cluster -H 'Content-Type: application/json' -d '{"move_shard":{"shard_id":1,"from_peer_id":121400021250061,"to_peer_id":7532708151186215}}'
Setting Value Meaning
POST /collections/glove/cluster instruction to the council to change the collection’s distribution
move_shard move: create a copy, then remove the old copy
shard_id 1 which shelf section
from_peer_id 121400021250061 from qdrant-0
to_peer_id 7532708151186215 to qdrant-3

Expected:

{"result":true,"status":"ok","time":0.391119829}

true only means: the council has accepted the order. The move runs in the background.

Step 2 – check. Ten seconds later:

# on vdb1
curl -s http://10.42.0.21:6333/collections/glove/cluster

Expected:

{"result":{"peer_id":7532708151186215,"shard_count":3,"local_shards":[{"shard_id":1,"points_count":424230,"state":"Active"}],"remote_shards":[{"shard_id":0,"peer_id":857928665674298,"state":"Active"},{"shard_id":2,"peer_id":1485700002748332,"state":"Active"}],"shard_transfers":[]},"status":"ok","time":0.000981441}

Shard 1 is on qdrant-3 with all 424,230 points and Active; shard_transfers is empty.

Step 3 – look up in the log how the move happened.

# on vdb1
kubectl -n qdrant logs qdrant-3 --since=5m
  • --since=5m only the lines from the last five minutes.

Expected (excerpt – look for the lines with snapshot and Recover):

2026-12-05T23:59:51.779471Z  INFO collection::shards::local_shard::snapshot: Restoring shard snapshot /qdrant/./storage/tmp/glove-shard-1HIO6vo
2026-12-05T23:59:55.225816Z  INFO collection::shards::local_shard: Recovering shard ./storage/collections/glove/1: 0/0 (0%)
2026-12-05T23:59:55.256741Z  INFO collection::shards::local_shard: Recovered collection glove: 0/0 (100%)

Qdrant transferred the shard as a snapshot – segments including the finished HNSW graph and quantized version – and restored it on the target. Nine seconds passed from the order (23:59:46) to the finished shard (23:59:55). The index did not have to be rebuilt.

# on vdb1
curl -s http://10.43.151.237:6333/collections/glove -o g.json
# on vdb1
jq -c '.result|{status,optimizer_status,points_count,indexed_vectors_count,segments_count}' g.json

Expected:

{"status":"green","optimizer_status":"ok","points_count":1183514,"indexed_vectors_count":1183514,"segments_count":6}

Step 4 – measure.

# on vdb1
cd ~/labor/tag08
# on vdb1
~/werkbank/bin/python last-prozesse.py http://10.43.151.237:6333 glove glove-fragen.npy 16 8000

Expected (two runs):

parallel 16 (Prozesse) · 8000 Anfragen in 21.0 s · 382 Anfragen/s · p50 29.1 ms · p95 61.1 ms · p99 88.4 ms · max 153.6 ms · Fehler 0
parallel 16 (Prozesse) · 8000 Anfragen in 16.7 s · 480 Anfragen/s · p50 27.5 ms · p95 52.6 ms · p99 72.2 ms · max 122.6 ms · Fehler 0

The first run is cold (the pages of the new shard were not yet in vdb1’s memory); the second, at 480 requests/s, is a good 10 % above the 433 before the move – as much as the noise from Day 8. That is no proof of more throughput. The load generator also runs on vdb1 and takes CPU away from the new pod.

# on vdb1
kubectl -n qdrant top pods

Expected (right after the run):

NAME       CPU(cores)   MEMORY(bytes)   
qdrant-0   353m         267Mi           
qdrant-1   1252m        489Mi           
qdrant-2   1167m        471Mi           
qdrant-3   1732m        148Mi           

The work has shifted: qdrant-0 no longer holds a glove shard and hardly computes anything, qdrant-3 the most.

Step 5 – change the number of shards? Three shards on four nodes leave one node without a glove shard. More shards would be the solution – Qdrant has resharding for this:

# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/glove/cluster -H 'Content-Type: application/json' -d '{"start_resharding":{"direction":"up"}}'
  • start_resharding with "direction":"up" would add a shard and distribute points onto it.

Expected:

{"status":{"error":"Bad request: resharding is only supported in Qdrant Cloud"},"time":0.000135857}

In the self-hosted version, the shard count set at creation stays. If you want to grow, create collections from the start with more shards than nodes (for example 6 or 12 with three nodes), or rebuild the collection and migrate the data.

Remember: moving shards is fast and without downtime, because Qdrant transfers finished segments including the index. The number of shards, on the other hand, you set at creation – plan it for the cluster you will have in two years.

Save your progress? Sign up for free

Drill 7: Closing a branch – wrong and right

Where you are: on vdb1, in ~/labor/tag09.

What you have afterwards: seen what happens when you simply tear down a node with data, and then removed it in the right order.

Step 1 – wrong: simply back to three pods. In the values file, change line 4 back to replicaCount: 3.

# on vdb1
cd ~/labor/tag09
# on vdb1
nano qdrant-werte.yaml
~/labor/tag09/qdrant-werte.yaml changes in green
image:
  tag: v1.20.3

replicaCount: 3

nodeSelector:
  vdb-rolle: daten

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            app.kubernetes.io/name: qdrant
        topologyKey: kubernetes.io/hostname

resources:
  requests:
    cpu: 500m
    memory: 1Gi
  limits:
    memory: 2Gi

persistence:
  size: 4Gi
  storageClassName: longhorn

startupProbe:
  enabled: true

livenessProbe:
  enabled: true

config:
  telemetry_disabled: true

podDisruptionBudget:
  enabled: true
  maxUnavailable: 1
# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
LAST DEPLOYED: Sun Dec  6 00:01:16 2026
STATUS: deployed
REVISION: 13

No conflict anymore – the field has belonged to Helm again since Drill 5.

# on vdb1
kubectl -n qdrant get pods

Expected (20 seconds later):

NAME       READY   STATUS    RESTARTS   AGE
qdrant-0   1/1     Running   0          10m
qdrant-1   1/1     Running   0          9m2s
qdrant-2   1/1     Running   0          10m

All green. And the readers?

# on vdb1
curl -s -w ' HTTP %{http_code}\n' -X POST http://10.43.151.237:6333/collections/glove/points/count -H 'Content-Type: application/json' -d '{"exact":true}'

Expected:

{"status":{"error":"Service internal error: 1 of 1 read operations failed:\n  Service internal error: Tonic status error: code: 'The service is currently unavailable', message: \"Failed to connect to http://qdrant-3.qdrant-headless:6335/, error: transport error\""},"time":0.479339445} HTTP 500

Shard 1 has disappeared together with qdrant-3. Three pods Running, all probes green – and a third of glove cannot be read.

# on vdb1
kubectl -n qdrant get pvc

Expected:

NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
qdrant-storage-qdrant-0   Bound    pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8   4Gi        RWO            longhorn       <unset>                 30h
qdrant-storage-qdrant-1   Bound    pvc-e760fa38-f3f3-446d-9edc-6453b63e6b61   4Gi        RWO            longhorn       <unset>                 14h
qdrant-storage-qdrant-2   Bound    pvc-37095780-0d56-4966-a719-884783ff8977   4Gi        RWO            longhorn       <unset>                 14h
qdrant-storage-qdrant-3   Bound    pvc-b3dc53d4-b23f-4f5b-a604-53a03f407f80   4Gi        RWO            longhorn       <unset>                 2m59s

The data is not gone: when scaling down, a StatefulSet does not delete the PVCs. The shelf section is locked away, not burned.

Step 2 – unlock the branch again. Line 4 back to replicaCount: 4 – the file then looks again as in Drill 5, Step 2 – then roll out.

# on vdb1
nano qdrant-werte.yaml
# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
LAST DEPLOYED: Sun Dec  6 00:01:59 2026
STATUS: deployed
REVISION: 14
# on vdb1
kubectl -n qdrant rollout status statefulset/qdrant --timeout=300s

Expected:

Waiting for 1 pods to be ready...
partitioned roll out complete: 4 new pods have been updated...
# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/glove/points/count -H 'Content-Type: application/json' -d '{"exact":true}'

Expected:

{"result":{"count":1183514},"status":"ok","time":0.281860438}

qdrant-3 is back with its old volume and its old peer_id; all points are readable. Its pod IP has changed – for us now 10.42.0.22 (kubectl -n qdrant get pods -o wide).

Step 3 – right, first: withdraw the shelf section.

# on vdb1
curl -s -X POST http://10.43.151.237:6333/collections/glove/cluster -H 'Content-Type: application/json' -d '{"move_shard":{"shard_id":1,"from_peer_id":7532708151186215,"to_peer_id":121400021250061}}'

Expected:

{"result":true,"status":"ok","time":0.355024759}

Step 4 – right, second: check that qdrant-3 really is empty. For every collection.

# on vdb1
curl -s http://10.42.0.22:6333/collections/glove/cluster

Expected:

{"result":{"peer_id":7532708151186215,"shard_count":3,"local_shards":[],"remote_shards":[{"shard_id":0,"peer_id":857928665674298,"state":"Active"},{"shard_id":1,"peer_id":121400021250061,"state":"Active"},{"shard_id":2,"peer_id":1485700002748332,"state":"Active"}],"shard_transfers":[]},"status":"ok","time":0.000141684}
# on vdb1
curl -s http://10.42.0.22:6333/collections/verteilt/cluster

Expected:

{"result":{"peer_id":7532708151186215,"shard_count":3,"local_shards":[],"remote_shards":[{"shard_id":0,"peer_id":1485700002748332,"state":"Active"},{"shard_id":0,"peer_id":121400021250061,"state":"Active"},{"shard_id":1,"peer_id":857928665674298,"state":"Active"},{"shard_id":1,"peer_id":1485700002748332,"state":"Active"},{"shard_id":2,"peer_id":857928665674298,"state":"Active"},{"shard_id":2,"peer_id":121400021250061,"state":"Active"}],"shard_transfers":[]},"status":"ok","time":0.000045813}
# on vdb1
curl -s http://10.42.0.22:6333/collections/doku/cluster

Expected:

{"result":{"peer_id":7532708151186215,"shard_count":1,"local_shards":[],"remote_shards":[{"shard_id":0,"peer_id":857928665674298,"state":"Active"},{"shard_id":0,"peer_id":121400021250061,"state":"Active"}],"shard_transfers":[]},"status":"ok","time":0.000036042}

"local_shards":[] everywhere. According to the log of qdrant-0, the withdrawal was finished after about ten seconds (Restoring shard snapshot at 00:02:43, Recovered collection glove at 00:02:49).

Step 5 – right, third: tear down the pod. Line 4 back to replicaCount: 3 – the file then looks as in Step 1.

# on vdb1
nano qdrant-werte.yaml
# on vdb1
helm upgrade qdrant qdrant/qdrant --version 1.20.3 -n qdrant -f qdrant-werte.yaml

Expected (excerpt):

Release "qdrant" has been upgraded. Happy Helming!
LAST DEPLOYED: Sun Dec  6 00:03:15 2026
STATUS: deployed
REVISION: 15

Step 6 – right, fourth: strike the member from the council.

# on vdb1
curl -s http://10.43.151.237:6333/cluster | jq -c '.result|{peers:(.peers|keys),raft_info}'
  • .peers|keys shows only the peer_ids of the members.

Expected:

{"peers":["121400021250061","1485700002748332","7532708151186215","857928665674298"],"raft_info":{"term":211,"commit":143,"pending_operations":0,"leader":1485700002748332,"role":"Follower","is_voter":true}}

The pod is gone, but the council still has four members. A majority of four is three – if another pod fails now, the council is no longer quorate. So strike it:

# on vdb1
curl -s -X DELETE http://10.43.151.237:6333/cluster/peer/7532708151186215
  • DELETE /cluster/peer/<peer_id> removes a member from the Raft cluster. Only remove peers that you proved to be empty in Step 4.

Expected:

{"result":true,"status":"ok","time":0.170384055}
# on vdb1
curl -s http://10.43.151.237:6333/cluster | jq -c '.result|{peers:(.peers|keys),raft_info,message_send_failures}'

Expected:

{"peers":["121400021250061","1485700002748332","857928665674298"],"raft_info":{"term":211,"commit":144,"pending_operations":0,"leader":1485700002748332,"role":"Follower","is_voter":true},"message_send_failures":{}}

Three members, no send failures.

Step 7 – clean up. The volume of qdrant-3 is empty and no longer needed; vdb1 is once again only the workbench.

# on vdb1
kubectl -n qdrant delete pvc qdrant-storage-qdrant-3

Expected:

persistentvolumeclaim "qdrant-storage-qdrant-3" deleted from qdrant namespace
# on vdb1
kubectl label node vdb1 vdb-rolle-
  • vdb-rolle- with a minus at the end removes the label.

Expected:

node/vdb1 unlabeled

Remember: you close a branch in four steps: move the shelves out, check that it is empty, tear down the building, strike it from the council. That is exactly why there is no HorizontalPodAutoscaler for Qdrant – it only knows the third step.

Save your progress? Sign up for free

Diagnosis task: Slow, but healthy

A colleague reports: “Since this morning’s deployment, search takes four seconds. All Qdrant pods are Running, no restarts, no errors in the log, the nodes have enough free memory.”

Before you read on: which three commands do you run, and what do you expect to see?

Solution path (you ran all the commands in Drills 2 and 3):

  1. kubectl -n qdrant exec qdrant-0 -c qdrant -- cat /sys/fs/cgroup/memory.current /sys/fs/cgroup/memory.max – if memory.current is close to the limit, the pod is squeezed, no matter how much the node has free.
  2. kubectl -n qdrant exec qdrant-0 -c qdrant -- grep -E '^(anon|file|workingset_refault_file|pgmajfault) ' /sys/fs/cgroup/memory.stat – file tiny, workingset_refault_file rising with every call: the messengers are running to the closed stacks.
  3. vmstat 5 2 on the pod’s node – high values in b, bi and wa.

In Drill 3, this is exactly what 128 Mi looked like: 2.7 MiB for file pages, 14.7 million refaults, 34 waiting processes, 40 MB/s of reads. The cause is then in the morning’s deployment – a resources.limits.memory that is too tight. The solution is a limit that holds anon plus quantized version plus graph plus reserve, and an alert rule on refaults instead of only on restarts (Day 11).

Checkpoint

# on vdb1
kubectl get nodes -L vdb-rolle

Expected:

NAME   STATUS   ROLES           AGE   VERSION        VDB-ROLLE
vdb1   Ready    control-plane   32h   v1.37.3+k3s1   
vdb2   Ready    <none>          32h   v1.37.3+k3s1   daten
vdb3   Ready    <none>          32h   v1.37.3+k3s1   daten
vdb4   Ready    <none>          32h   v1.37.3+k3s1   daten
# on vdb1
kubectl -n qdrant get pods -o wide

Expected:

NAME       READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINATED NODE   READINESS GATES
qdrant-0   1/1     Running   0          12m   10.42.2.10   vdb3   <none>           <none>
qdrant-1   1/1     Running   0          11m   10.42.3.24   vdb4   <none>           <none>
qdrant-2   1/1     Running   0          12m   10.42.1.38   vdb2   <none>           <none>
# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io -o custom-columns=NAME:.metadata.name,STATE:.status.state,ROBUST:.status.robustness

Expected: all volumes attached and healthy.

# on vdb1
curl -s http://10.43.151.237:6333/collections

Expected:

{"result":{"collections":[{"name":"doku"},{"name":"glove"},{"name":"verteilt"}]},"status":"ok","time":0.000071961}
# on vdb1
kubectl -n qdrant exec qdrant-0 -c qdrant -- df -h /qdrant/storage

Expected:

Filesystem                                              Size  Used Avail Use% Mounted on
/dev/longhorn/pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8  3.9G  417M  3.5G  11% /qdrant/storage

Three pods with a 2 Gi limit, the council with three members, glove fully indexed and still present. vdb1 no longer carries a data node label.

Test yourself

  1. A collection has 10 million vectors with 768 dimensions. How much memory do you plan according to the rule of thumb?
  2. kubectl top shows 300 Mi for a Qdrant pod, the limit is 2 Gi. Can you lower the limit to 512 Mi?
  3. Why did the 256 Mi limit not slow down search on glove, but 128 Mi slowed it by more than a factor of 80?
  4. A Qdrant pod does not start; the last line in the log is Loading collection: glove, no error. Where do you look next?
  5. You scale Qdrant from three to four pods. How many requests does the new pod take over for existing collections?
  6. Why is a HorizontalPodAutoscaler dangerous for Qdrant, even if it only scales up?

Answers:

  1. 10,000,000 × 768 × 4 bytes × 1.5 ≈ 46 GB – distributed across shards and multiplied by the number of copies. With quantization and originals on disk, considerably less in RAM, but the disk still needs the space.
  2. Not without looking at memory.stat. kubectl top does not count the inactive file pages. What matters is whether anon plus the constantly read files (quantized version, graph) fit into 512 Mi with a reserve – and you measure that under load, as in Drill 3.
  3. With 256 Mi, 176 MiB remained for file pages, enough for the quantized version (44 MiB) and graph (22 MiB) per shard. With 128 Mi, 2.7 MiB remained under load, and every search had to fetch pages from the Longhorn volume: 4 instead of 342 requests/s.
  4. In the pod’s status (Last State: OOMKilled, exit code 137 in kubectl describe) and in the node’s kernel log (journalctl -k --grep 'Memory cgroup out of memory'). A process terminated with SIGKILL writes nothing more.
  5. None. The new peer holds no shards ("local_shards":[]) until you move some there with move_shard or create new collections.
  6. Scaled-up pods are empty and bring nothing. And every pod becomes a member of the Raft council: if the autoscaler later scales down again, pods disappear with their shards (Drill 7: HTTP 500 with green probes), and the members remain in the council and shift the majority.

Interview note

“How do you plan the memory for a vector database, and how do you scale it?” – I calculate with points × dimensions × 4 bytes × 1.5, times the number of copies, and verify that against the segment files of a real shard. With Qdrant, the largest part is mapped files: for the limits I look at anon and file in memory.stat, not at kubectl top. A limit below the hot part of the files makes search orders of magnitude slower without any pod restarting – that is why I alert on refaults and p99, not just on restarts. Scaling is done by hand: add nodes, move shards with move_shard, and when removing, first empty the node, then remove the peer from the Raft cluster. I set the shard count generously at creation, because resharding is not possible in the self-hosted version.

Enterprise note

In production, data nodes get their own machines of equal size and a memory limit equal to the request (Guaranteed QoS), so that the kernel hits them last under node pressure. Limits are changed with a canary: one pod first, for example via the StatefulSet’s updateStrategy.rollingUpdate.partition, then measure, then the rest – Drill 4 showed how a rollout to all pods turns one OOMKilled into two. The shard distribution belongs in a runbook with verification steps after every move; according to the error message from Drill 6, resharding exists only in Qdrant Cloud, and in the self-hosted version it remains manual work. For growth beyond one node, teams plan the shard count as a multiple of the expected number of nodes and keep a memory reserve for a node failure: if one of three fails, two have to carry the load.

Summary

  • Shard 2 of glove (392,053 points × 100 dimensions): 150 MiB of original vectors – exactly points × 400 bytes –, 44 MiB int8 version, 22 MiB HNSW graph, 222 MiB in total. The rule of thumb × 1.5 fits.
  • The pod had 89 MiB of anonymous memory and 365 MiB of mapped files. kubectl top showed 301 Mi, because it does not count inactive file pages.
  • With a 256 Mi limit: no change (343 requests/s). With 128 Mi: 4 requests/s, p50 3.9 s, zero errors, zero restarts; on the node 34 waiting processes and 40 MB/s of reads.
  • With 64 Mi: OOMKilled, exit code 137, while loading glove. An exact count request additionally killed the pod with 128 Mi, and the controller replaced it with 64 Mi – two of three pods down. Resetting took a good two minutes, no point was missing.
  • After the restart, glove stood at grey until an empty change triggered the optimizers; after that all 1,183,514 points were indexed, 433 requests/s.
  • A fourth pod started in 50 seconds – empty. move_shard moved 424,230 points in nine seconds, as a snapshot including the index. More throughput could not be proven.
  • Resharding: “only supported in Qdrant Cloud”.
  • Removal without moving: HTTP 500 with green probes, PVC remains. Right: move, verify, remove, DELETE /cluster/peer.

Commands at a glance

Command Purpose
curl -s http://<pod-ip>:6333/collections/<name>/cluster which shards a peer holds itself
kubectl -n qdrant exec <pod> -c qdrant -- du -sh /qdrant/storage/collections/<name>/<shard>/segments space of a shard on the volume
kubectl -n qdrant exec <pod> -c qdrant -- cat /sys/fs/cgroup/memory.current /sys/fs/cgroup/memory.max used memory and limit of the container
kubectl -n qdrant exec <pod> -c qdrant -- grep -E '^(anon\|file\|active_file\|inactive_file) ' /sys/fs/cgroup/memory.stat split into anon and file pages
kubectl -n qdrant top pods working set and CPU of the pods
vmstat 5 2 waiting processes, reads, I/O wait on the node
kubectl -n qdrant describe pod <pod> Last State, OOMKilled, exit code
kubectl -n qdrant logs <pod> -c qdrant --previous --tail=8 log of the crashed run
sudo journalctl -k --since '-10 min' --grep 'Memory cgroup out of memory' --no-pager OOM messages from the kernel
curl -s -X PATCH <url>/collections/<name> -H 'Content-Type: application/json' -d '{"optimizers_config":{}}' trigger the optimizers after a restart
helm upgrade … --force-conflicts take over fields that belong to another manager
kubectl label node vdb1 vdb-rolle=daten / vdb-rolle- mark a node as data node / remove the label
curl -s -X POST <url>/collections/<name>/cluster -H 'Content-Type: application/json' -d '{"move_shard":{"shard_id":…,"from_peer_id":…,"to_peer_id":…}}' move a shard
curl -s -X DELETE <url>/cluster/peer/<peer_id> remove an empty peer from the Raft cluster
kubectl -n qdrant delete pvc qdrant-storage-qdrant-3 delete the volume of a removed pod

Contents

More