Day 14: Milvus – the big library with departments
Goal: run Milvus standalone with Helm, know its departments and dependencies, load and measure the same data, experience consistency levels and an object storage outage, and compare all three systems with real numbers · Duration: about 150 min · Prerequisite: Day 0 to Day 13
State before this chapter
Three Qdrant pods are running with TLS, API keys, NetworkPolicies and
Pod Security restricted; the monitoring from Day 11 and the
off-site store (SeaweedFS) from Day 12 are in place on vdb1. The branch
from Day 13 has been taken down again; vdb2 has room.
# on vdb1
kubectl -n qdrant get pods -o wideExpected (your IPs, nodes and ages will differ):
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
qdrant-0 1/1 Running 0 3h39m 10.42.1.61 vdb2 <none> <none>
qdrant-1 1/1 Running 0 3h40m 10.42.3.8 vdb4 <none> <none>
qdrant-2 1/1 Running 0 3h41m 10.42.2.18 vdb3 <none> <none>
Today you again need the doku files from Day 1
(~/labor/tag01/korpus.jsonl, vektoren.npy) and
glove-100 from Day 8 (~/labor/tag08/glove-bestand.npy,
glove-fragen.npy, glove-wahrheit.npy). All
commands run on vdb1 in the folder ~/labor/tag14:
# on vdb1
mkdir -p ~/labor/tag14
cd ~/labor/tag14Introduction
Qdrant is a program that does everything itself: accept, store, index, search. pgvector lives in the house of PostgreSQL. Milvus takes a third path: it splits the work into departments that scale individually, and puts all data into an object storage. It is built for billions of vectors – and comes with parts you do not know from the other two: a catalog in etcd, an accession register in the object storage, a reading room into which you first have to fetch holdings.
Today you run Milvus as standalone: all departments in one pod, plus etcd. Your off-site store from Day 12 serves as the object storage. You only work through the cluster mode with its own pods per department on paper – and see why it does not fit into this lab.
Real surprises await you along the way: a secret key in plain text, a recall that changes while nobody does anything, a new book that the reading room does not see, and an insert that ends with an error and arrives anyway.
Today you will learn:
- to install Milvus 3.0 standalone with Helm and connect it to an existing S3 storage,
- to recognize the departments of Milvus (proxy, coordinator, streaming, data, query) and their dependencies,
- to create, fill, index and load collections – and to know why
loadis necessary, - to measure recall@10 and throughput and see how segments change recall,
- to distinguish the consistency levels
Eventually,Bounded,SessionandStrong, - to assess what an object storage outage means for reading and writing,
- to compare Qdrant, pgvector and Milvus by measurements and by operational effort.
Background
The picture of the day: the big library with departments
The central library of a big city does not work like a branch. Every task has its department: the information desk at the entrance accepts every request. The directorate decides who shelves what and which holdings are on display where. Every new acquisition is first written into the accession register. The shelvers pack the books onto book trolleys, bind finished trolleys into fixed shelves and build the signposts. Reading happens only in the reading room – and only what was fetched from the closed stacks beforehand is there.
The catalog (which holdings, which shelves, which state) is kept in its own card cabinet. The books themselves and the signposts are stored in the closed stacks – here in the off-site store from Day 12. At night, the shelvers merge small book trolleys into big ones.
In standalone operation, all departments sit in one building. In cluster operation, each gets its own – with its own staff that can be increased individually.
The terms
| Term | Meaning | In the picture |
|---|---|---|
| Proxy | accepts client requests (port 19530), checks and distributes them | information desk |
| MixCoord | coordinator: metadata, assignment of segments and channels, index jobs | directorate |
| StreamingNode, Woodpecker | writes every change into a write-ahead log; Woodpecker stores it in the object storage | accession register |
| DataNode | persists segments, compacts them (compaction), builds indexes | shelvers |
| QueryNode | keeps loaded segments in memory and answers searches | reading room |
| etcd | metadata: collections, segments, states | catalog |
| object storage (S3) | data, indexes and WAL as files | closed stacks |
| segment | data block of a collection; growing or sealed | book trolley |
flush |
seal growing segments and write them to the object storage | close the trolley |
load / release |
fetch a collection into the reading room / release it again | fetch holdings |
| consistency level | how current the state is that a search sees | how far the reading room lags behind |
Remember: Milvus separates accepting, shelving and reading. Everything persistent is in etcd and in the object storage – searches only cover what is loaded.
Drill 1: Closed stacks in the off-site store
The chart comes with its own MinIO. MinIO has been archived since April 2026, and with the off-site store you already have a maintained S3 storage. Milvus gets its own bucket there and a key that is only allowed to access this bucket – just like Qdrant on Day 12.
Step 1 – generate the key. As on Day 12: 20 random bytes as hex text, then a version without a line break for Helm.
# on vdb1
openssl rand -hex -out s3-geheim-milvus 20# on vdb1
chmod 600 s3-geheim-milvus# on vdb1
tr -d "\n" < s3-geheim-milvus > s3-geheim-milvus.einzeilig# on vdb1
wc -c s3-geheim-milvus s3-geheim-milvus.einzeiligExpected:
41 s3-geheim-milvus
40 s3-geheim-milvus.einzeilig
81 total
What you see: a 40-character key, plus a line break in the first file. As on Day 11 and 12, the line break is not part of the key.
Step 2 – back up the badge list. At the end of the day you restore it.
# on vdb1
sudo cp /etc/seaweedfs/s3.json /etc/seaweedfs/s3.json.vor-tag14Step 3 – add the badge for Milvus. For
secretKey in the new entry, insert the content of
s3-geheim-milvus.einzeilig; the book shows
placeholders.
# on vdb1
sudo nano /etc/seaweedfs/s3.json{
"identities": [
{
"name": "qdrant",
"credentials": [
{
"accessKey": "qdrant-sicherung",
"secretKey": "<INHALT VON s3-geheim-qdrant>"
}
],
"actions": [
"Read:qdrant-sicherung",
"Write:qdrant-sicherung",
"List:qdrant-sicherung",
"Tagging:qdrant-sicherung"
]
},
{
"name": "milvus",
"credentials": [
{
"accessKey": "milvus-daten",
"secretKey": "<INHALT VON s3-geheim-milvus.einzeilig>"
}
],
"actions": [
"Read:milvus-daten",
"Write:milvus-daten",
"List:milvus-daten",
"Tagging:milvus-daten"
]
},
{
"name": "verwalter",
"credentials": [
{
"accessKey": "lager-verwalter",
"secretKey": "<INHALT VON s3-geheim-verwalter>"
}
],
"actions": [
"Admin"
]
}
]
}accessKeymilvus-daten– the user name, the same as the bucket name; not secret.actions– read, write, list and tags, all only for the bucketmilvus-daten.
Step 4 – restart the off-site store and create the bucket. SeaweedFS reads the file at startup.
# on vdb1
sudo systemctl restart aussenlager# on vdb1
systemctl is-active aussenlagerExpected:
active
# on vdb1
~/werkbank/bin/aws --profile verwalter s3 mb s3://milvus-datenExpected:
make_bucket: milvus-daten
Remember: Every system gets its own room and its own key in the closed stacks. If a key falls into the wrong hands, only one bucket is affected.
Save your progress? Sign up for free
Drill 2: Milvus standalone with Helm
Step 1 – the chart repository.
# on vdb1
helm repo add milvus https://zilliztech.github.io/milvus-helm/Expected:
"milvus" has been added to your repositories
helm search repo milvus/milvus --versions shows chart
5.0.35 with Milvus 3.0.7 as the newest version (yours may be newer –
stay with 5.0.35 for the book).
Step 2 – look at the defaults. The chart’s values
file is long; save it and read the sections cluster,
standalone, streaming, minio,
etcd, pulsarv3 and
externalS3.
# on vdb1
helm show values milvus/milvus --version 5.0.35 > chart-werte.yaml# on vdb1
wc -l chart-werte.yamlExpected:
1503 chart-werte.yaml
Three defaults are wrong for this lab:
cluster.enabled: true (own pods per department),
etcd.replicaCount: 3 and
pulsarv3.enabled: true (a Pulsar cluster as message
storage). In addition, minio.enabled: true with
accessKey: minioadmin and
secretKey: minioadmin – publicly known credentials.
Step 3 – your values.
# on vdb1
nano milvus-werte.yamlcluster:
enabled: false
standalone:
messageQueue: woodpecker
nodeSelector:
kubernetes.io/hostname: vdb2
resources:
requests:
cpu: "2"
memory: 4Gi
limits:
memory: 8Gi
persistence:
persistentVolumeClaim:
storageClass: longhorn
size: 10Gi
streaming:
woodpecker:
embedded: true
storage:
type: minio
etcd:
replicaCount: 1
nodeSelector:
kubernetes.io/hostname: vdb2
persistence:
storageClass: longhorn
size: 2Gi
minio:
enabled: false
pulsarv3:
enabled: false
externalS3:
enabled: true
host: 172.16.0.182
port: "8333"
bucketName: milvus-daten
rootPath: bibliothek
useSSL: false| Setting | Value | Meaning |
|---|---|---|
cluster.enabled |
false |
standalone: all departments in one pod
(milvus run standalone) |
standalone.messageQueue |
woodpecker |
accession register without its own service (alternatives: Pulsar, Kafka, RocksMQ) |
nodeSelector |
vdb2 |
the node with 8 vCPU and 16 GB |
resources |
2 CPU, 4–8 Gi | request and limit; Milvus keeps loaded data in memory |
persistence |
10 Gi Longhorn | local volume of the pod under /var/lib/milvus |
streaming.woodpecker |
embedded, minio |
Woodpecker runs in the Milvus process and writes the WAL to the object storage |
etcd.replicaCount |
1 |
one etcd instead of three – enough in the lab, not in production |
minio.enabled |
false |
no MinIO of its own |
pulsarv3.enabled |
false |
no Pulsar |
externalS3 |
off-site store, bucket, path | type: minio only means “S3 interface”; the target is
SeaweedFS |
useSSL |
false |
the off-site store does not speak TLS in the lab (as on Day 12) |
The credentials are not in the file; they are added during installation.
Step 4 – install.
# on vdb1
helm install milvus milvus/milvus --version 5.0.35 -n milvus --create-namespace -f milvus-werte.yaml --set externalS3.accessKey=milvus-daten --set-file externalS3.secretKey=s3-geheim-milvus.einzeilig| Setting | Value | Meaning |
|---|---|---|
-n milvus --create-namespace |
own namespace | |
-f milvus-werte.yaml |
your values | |
--set externalS3.accessKey=… |
milvus-daten |
user name of the badge |
--set-file externalS3.secretKey=… |
file without line break | reads the value from the file – it does not appear in the shell history |
Expected:
NAME: milvus
LAST DEPLOYED: Sun Dec 6 06:10:22 2026
NAMESPACE: milvus
STATUS: deployed
REVISION: 1
DESCRIPTION: Install complete
TEST SUITE: None
Step 5 – wait.
# on vdb1
kubectl -n milvus wait --for=condition=Ready pod --all --timeout=600sExpected (for me just under two minutes after the command, three minutes after the installation):
pod/milvus-etcd-0 condition met
pod/milvus-standalone-66668c74b5-fbdsz condition met
Remember: The chart’s defaults are meant for a cluster with Pulsar and MinIO. If you want standalone, explicitly switch off
cluster,pulsarv3andminio.
Save your progress? Sign up for free
Drill 3: Looking at the departments
Step 1 – what was created.
# on vdb1
kubectl -n milvus get deployment,statefulset,service,pvcExpected (your IPs and volume names will differ):
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/milvus-standalone 1/1 1 1 3m27s
NAME READY AGE
statefulset.apps/milvus-etcd 1/1 3m26s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/milvus ClusterIP 10.43.241.133 <none> 19530/TCP,9091/TCP 3m27s
service/milvus-etcd ClusterIP 10.43.71.87 <none> 2379/TCP,2380/TCP 3m27s
service/milvus-etcd-headless ClusterIP None <none> 2379/TCP,2380/TCP 3m27s
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
persistentvolumeclaim/data-milvus-etcd-0 Bound pvc-63d294a0-333b-4bb6-b2bd-00257681f0a7 2Gi RWO longhorn <unset> 3m26s
persistentvolumeclaim/milvus Bound pvc-0dd8e147-91ad-468c-8aad-037caa0f2f99 10Gi RWO longhorn <unset> 3m27s
| Object | Meaning |
|---|---|
deployment/milvus-standalone |
the pod with all departments |
statefulset/milvus-etcd |
the catalog |
service/milvus |
19530 for clients (gRPC and REST), 9091 for metrics and health |
| two PVCs | 2 Gi for etcd, 10 Gi for the Milvus pod |
Note the IP of service/milvus – all scripts today get it
as their first argument (for me 10.43.241.133).
Step 2 – how the pod is started.
# on vdb1
kubectl -n milvus get deployment milvus-standalone -o jsonpath='{.spec.strategy.type}{"\n"}{.spec.template.spec.containers[0].args}{"\n"}'Expected:
Recreate
["milvus","run","standalone"]
What you see: Recreate – during an
update, the old pod is stopped first, then the new one is started. With
a ReadWriteOnce volume that is the only option, but it
costs an interruption every time. milvus run standalone
starts all departments in one process.
Step 3 – the departments in the log.
# on vdb1
kubectl -n milvus logs deploy/milvus-standalone | grep -i -e "successfully started" -e "start successfully" -e "server finished"grep -i– case-insensitive;-ethree times – three search patterns, because each department reports its start a little differently.
Expected (shortened on the right):
[2026/12/06 06:11:57.975 +00:00] [INFO] [datanode/data_node.go:280] ["datanode start successfully"]
[2026/12/06 06:11:57.988 +00:00] [INFO] [components/mix_coord.go:60] ["MixCoord successfully started"]
[2026/12/06 06:11:57.993 +00:00] [INFO] [datanode/service.go:178] ["DataNode gRPC services successfully started"]
[2026/12/06 06:11:57.994 +00:00] [INFO] [components/data_node.go:61] ["Datanode successfully started"]
[2026/12/06 06:11:58.149 +00:00] [INFO] [streamingnode/service.go:205] ["init StreamingNode server finished"]
[2026/12/06 06:11:58.149 +00:00] [INFO] [querynodev2/server.go:456] ["query node start successfully"] [queryNodeID=1] [Address=10.42.1.67:21123] [mmapEnabled=false] [growingmmapEnable=false] [mmapVect
[2026/12/06 06:11:58.169 +00:00] [INFO] [components/query_node.go:61] ["QueryNode successfully started"]
[2026/12/06 06:11:58.265 +00:00] [INFO] [streamingnode/service.go:241] ["start StreamingNode server finished"]
[2026/12/06 06:11:58.728 +00:00] [INFO] [components/proxy.go:62] ["Proxy successfully started"]
What you see: directorate (MixCoord), shelvers
(DataNode), accession register (StreamingNode), reading room (QueryNode)
and finally the information desk (Proxy) – within one second, all in the
same process. mmapEnabled=false: the reading room keeps
loaded data in memory.
Step 4 – the configuration. The chart generates a ConfigMap from your values.
# on vdb1
kubectl -n milvus get configmap milvus -o jsonpath='{.data.default\.yaml}'Expected (excerpt – comment lines omitted, the key redacted by me):
etcd:
endpoints:
- milvus-etcd-0.milvus-etcd-headless.milvus.svc.cluster.local:2379
metastore:
type: etcd
minio:
address: 172.16.0.182
port: 8333
accessKeyID: milvus-daten
secretAccessKey: <geschwaerzt>
useSSL: false
bucketName: milvus-daten
rootPath: bibliothek
useIAM: false
cloudProvider: aws
iamEndpoint:
region:
useVirtualHost: false
mq:
type: woodpecker
What you see: The secret S3 key is in plain
text in a ConfigMap. ConfigMaps are not meant for secrets:
anyone allowed to read ConfigMaps in the namespace – often any role with
“view” – has the key. Add to that what you know from Day 10: Helm stores
passed values in its release Secret. Chart 5.0.35 offers no
existingSecret for externalS3; in production
you give Milvus the credentials via its own configuration from a Secret
or via an identity of the cloud provider (useIAM).
Step 5 – the local volume.
# on vdb1
kubectl -n milvus exec deploy/milvus-standalone -- ls /var/lib/milvusExpected:
data
lost+found
The volume is empty except for a folder data with 16 KB.
At the end of the day, with 1.2 million vectors, it is 36 KB. Everything
important is in etcd and in the closed stacks – you will see it in Drill
4.
Remember: With Milvus, the pod is almost stateless: catalog in etcd, data and accession register in the object storage. Whoever backs up Milvus backs up these two – not the pod’s volume.
Save your progress? Sign up for free
Drill 4: The first books – doku
For Milvus there is the Python client pymilvus. Install
it in the workbench:
# on vdb1
~/werkbank/bin/pip install --quiet pymilvus==3.0.4Step 1 – create and fill the collection. Milvus
needs a schema: which fields, which type, which
dimension. The text of the sections stays out today; id,
bereich and the vector are enough.
# on vdb1
nano doku-laden.py"""Legt die Collection doku in Milvus an und lädt die 13 220 Abschnitte aus Tag 1 (ohne Index, ohne load)."""
import json
import sys
import time
import numpy as np
from pymilvus import DataType, MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530") # IP des Service milvus
schema = client.create_schema(auto_id=False)
schema.add_field("id", DataType.INT64, is_primary=True)
schema.add_field("bereich", DataType.VARCHAR, max_length=64)
schema.add_field("embedding", DataType.FLOAT_VECTOR, dim=768)
client.create_collection("doku", schema=schema)
eintraege = [json.loads(z) for z in open("../tag01/korpus.jsonl", encoding="utf-8")]
vektoren = np.load("../tag01/vektoren.npy")
beginn = time.time()
for start in range(0, len(eintraege), 1000):
paket = [{"id": e["id"], "bereich": e["bereich"], "embedding": v}
for e, v in zip(eintraege[start:start + 1000], vektoren[start:start + 1000])]
client.insert("doku", paket)
print(f"{len(eintraege)} Abschnitte in {time.time() - beginn:.1f} s eingefügt")| Setting | Meaning |
|---|---|
auto_id=False |
the IDs come from the corpus; Milvus does not assign its own |
INT64, is_primary |
primary key |
VARCHAR, max_length=64 |
text with a maximum length – Milvus requires it |
FLOAT_VECTOR, dim=768 |
vector from nomic-embed-text |
insert in batches of 1000 |
as on Day 8: small batches cost time |
The loop is in the script, not in the book – you do not type it, you start the program:
# on vdb1
~/werkbank/bin/python doku-laden.py 10.43.241.133Expected:
13220 Abschnitte in 10.9 s eingefügt
Step 2 – search immediately.
# on vdb1
nano suche.py"""Sucht in doku die fünf nächsten Abschnitte zum Abschnitt mit der angegebenen Nummer."""
import sys
import numpy as np
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
nummer = int(sys.argv[2]) # z. B. 3500
vektor = np.load("../tag01/vektoren.npy")[nummer]
ergebnis = client.search("doku", data=[vektor], limit=5, anns_field="embedding",
output_fields=["bereich"], search_params={"metric_type": "COSINE"})
for treffer in ergebnis[0]:
print(treffer["id"], round(treffer["distance"], 4), treffer["entity"]["bereich"])# on vdb1
~/werkbank/bin/python suche.py 10.43.241.133 3500Expected (excerpt – the last line of the error message):
pymilvus.exceptions.MilvusException: <MilvusException: (code=101, message=failed to search: collection not loaded[collection=470951531147430179])>
What you see: The data is inserted, but the reading room is empty. Milvus only searches in loaded collections.
Step 3 – look at the state.
# on vdb1
nano zustand.py"""Zeigt Ladezustand, gezählte Zeilen und Indexe einer Collection."""
import sys
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
name = sys.argv[2] # doku oder glove
print("Ladezustand:", client.get_load_state(name)["state"].name)
print("Zeilen :", client.get_collection_stats(name)["row_count"])
for index in client.list_indexes(name):
info = client.describe_index(name, index)
print("Index :", info["index_type"], info["metric_type"], "M", info.get("M"),
"efConstruction", info.get("efConstruction"), "Status", info.get("state"),
f"{info.get('indexed_rows')}/{info.get('total_rows')}")# on vdb1
~/werkbank/bin/python zustand.py 10.43.241.133 dokuExpected:
Ladezustand: NotLoad
Zeilen : 12000
What you see: Not loaded, no index – and only 12,000
instead of 13,220 rows. The statistics only count sealed segments; the
last 1220 rows are still in a growing segment, that is, on the book
trolley that has not been closed yet. Anyone who tries to load now gets
index not found[collection=doku] (in the log): no index, no
reading room.
Step 4 – close, build the index, load. The three steps belong together; the script measures each one individually.
# on vdb1
nano einraeumen.py"""flush, HNSW-Index bauen, laden – und jede Phase stoppen."""
import sys
import time
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
name = sys.argv[2] # doku oder glove
beginn = time.time()
client.flush(name)
print(f"flush {time.time() - beginn:6.1f} s")
beginn = time.time()
parameter = client.prepare_index_params()
parameter.add_index(field_name="embedding", index_type="HNSW", metric_type="COSINE",
params={"M": 16, "efConstruction": 100})
client.create_index(name, parameter, sync=True)
print(f"Index (HNSW) {time.time() - beginn:6.1f} s")
beginn = time.time()
client.load_collection(name)
print(f"load {time.time() - beginn:6.1f} s")| Setting | Value | Meaning |
|---|---|---|
flush |
seal growing segments and write them to the closed stacks | |
index_type |
HNSW |
the same signposts as in Qdrant and pgvector |
metric_type |
COSINE |
cosine, as before |
M, efConstruction |
16, 100 | the same build values as on Day 4, 8 and 13 |
sync=True |
waits until the index is built for all segments | |
load_collection |
fetch segments including index into the reading room |
# on vdb1
~/werkbank/bin/python einraeumen.py 10.43.241.133 dokuExpected:
flush 1.7 s
Index (HNSW) 7.5 s
load 2.5 s
# on vdb1
~/werkbank/bin/python zustand.py 10.43.241.133 dokuExpected:
Ladezustand: Loaded
Zeilen : 13220
Index : HNSW COSINE M 16 efConstruction 100 Status Finished 13220/13220
# on vdb1
~/werkbank/bin/python suche.py 10.43.241.133 3500Expected:
3500 1.0 reference
11349 0.9177 tasks
11351 0.8763 tasks
11348 0.8571 tasks
3527 0.8568 reference
What you see: The section itself with similarity
1.0, then its neighbors. With COSINE, distance
in Milvus is a similarity: larger is closer.
Step 5 – look into the closed stacks.
# on vdb1
~/werkbank/bin/aws --profile verwalter s3 ls s3://milvus-daten/bibliothek/Expected:
PRE index_files/
PRE insert_log/
PRE stats_log/
PRE wp/
| Folder | Content | In the picture |
|---|---|---|
insert_log/ |
the segment data, field by field | the books |
stats_log/ |
statistics per segment, e.g. primary keys | inventory slips |
index_files/ |
the built HNSW indexes | the signposts |
wp/ |
Woodpecker’s write-ahead log | the accession register |
Remember: In Milvus, “inserted” does not mean “searchable”. Only flush, index and
loadbring the holdings into the reading room – and the statistics only count sealed segments.
Save your progress? Sign up for free
Drill 5: glove – how long until searchable?
Now the million: glove-100 with 1,183,514 vectors, 100 dimensions, cosine.
Step 1 – the load script.
# on vdb1
nano glove-laden.py"""Legt die Collection glove an und fügt die 1 183 514 Vektoren aus Tag 8 in Paketen zu 10 000 ein."""
import sys
import time
import numpy as np
from pymilvus import DataType, MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
schema = client.create_schema(auto_id=False)
schema.add_field("id", DataType.INT64, is_primary=True)
schema.add_field("embedding", DataType.FLOAT_VECTOR, dim=100)
client.create_collection("glove", schema=schema)
bestand = np.load("../tag08/glove-bestand.npy")
beginn = time.time()
for start in range(0, len(bestand), 10_000):
paket = [{"id": start + i, "embedding": v} for i, v in enumerate(bestand[start:start + 10_000])]
client.insert("glove", paket)
dauer = time.time() - beginn
print(f"{len(bestand)} Vektoren in {dauer:.1f} s eingefügt ({len(bestand) / dauer:.0f} pro Sekunde)")The IDs are the row numbers – the same ones that are in
glove-wahrheit.npy.
# on vdb1
~/werkbank/bin/python glove-laden.py 10.43.241.133Expected:
1183514 Vektoren in 132.7 s eingefügt (8918 pro Sekunde)
Step 2 – shelve. The same script as for
doku. Put date +%T before and after it to see
the total time.
# on vdb1
~/werkbank/bin/python einraeumen.py 10.43.241.133 gloveExpected (from 06:21:53 to 06:24:53):
flush 2.7 s
Index (HNSW) 167.5 s
load 4.0 s
# on vdb1
kubectl -n milvus top podsExpected:
NAME CPU(cores) MEMORY(bytes)
milvus-etcd-0 26m 16Mi
milvus-standalone-66668c74b5-fbdsz 6161m 530Mi
What you see: Fully loaded – and still the pod keeps working with six cores. The shelvers have started merging small book trolleys (compaction). This runs in the background and took a good five minutes for me, with up to 6.6 cores and 2 GiB of memory. What this means for search is shown in Drill 6.
The times until the first search compared (glove-100, same build
values m 16 / 100):
| System | Insert | Index | Load | until searchable |
|---|---|---|---|---|
| Milvus (today, 1 pod on vdb2) | 132.7 s | 167.5 s | 4.0 s | approx. 5:07 min |
| Qdrant (Day 8, 3 shards) | 197 s | in the background | – | green a good 4 min after loading |
| pgvector (Day 13, 1 instance on vdb2) | 44.3 s (COPY) |
8:13 min (2 GB maintenance_work_mem) |
– | approx. 9 min |
Remember: “Searchable” is a different moment in every system. Measure from the first insert to the first search with an index – and expect follow-up work afterwards.
Save your progress? Sign up for free
Drill 6: recall@10 – and why it changes
Step 1 – the measurement script. The same question as on Day 8 and 13, the same ground truth.
# on vdb1
nano glove-recall.py"""Misst recall@10 von Milvus auf glove-100 gegen die mitgelieferte Wahrheit (1000 Fragen)."""
import sys
import time
import numpy as np
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
ef = int(sys.argv[2]) # Suchbreite, mindestens 10
fragen = np.load("../tag08/glove-fragen.npy")
wahrheit = np.load("../tag08/glove-wahrheit.npy")
treffer, beginn = 0, time.perf_counter()
for vektor, beste10 in zip(fragen, wahrheit):
ergebnis = client.search("glove", data=[vektor], limit=10, anns_field="embedding",
search_params={"metric_type": "COSINE", "params": {"ef": ef}})
treffer += len({t["id"] for t in ergebnis[0]} & set(beste10.tolist()))
dauer = time.perf_counter() - beginn
print(f"ef {ef} · recall@10 {treffer / (len(fragen) * 10):.3f} · {len(fragen)} Fragen in {dauer:.1f} s")params: {"ef": …}– the HNSW search width in Milvus; it must be at least as large aslimit.
Step 2 – measure right after loading.
# on vdb1
~/werkbank/bin/python glove-recall.py 10.43.241.133 10Expected:
ef 10 · recall@10 0.585 · 1000 Fragen in 16.4 s
Repeat with 40, 100 and
256.
Step 3 – count the segments.
# on vdb1
nano segmente.py"""Listet die geladenen Segmente einer Collection mit Zeilenzahl."""
import sys
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
segmente = client.list_loaded_segments(sys.argv[2])
for s in sorted(segmente, key=lambda s: s.num_rows):
print(s.segment_id, s.num_rows, s.state)
print(len(segmente), "Segmente,", sum(s.num_rows for s in segmente), "Zeilen")Right after loading, I had five segments with 38,654, 275,140,
279,720, 289,720 and 300,280 rows, each with its own HNSW index (queried
with the older call utility.get_query_segment_info). After
the merge, a good five minutes later:
# on vdb1
~/werkbank/bin/python segmente.py 10.43.241.133 gloveExpected:
470951531151004070 1183514 Sealed
1 Segmente, 1183514 Zeilen
Step 4 – measure again. The same command as in Step
2, again with 10, 40, 100 and
256.
Expected – all eight runs (1000 queries one after another, raw output in the log), alongside pgvector (Day 13) and Qdrant (Day 8):
ef |
Milvus, 5 segments | Milvus, 1 segment | pgvector, 1 index | Qdrant, 3 shards |
|---|---|---|---|---|
| 10 | 0.585 (16.4 s) | 0.473 (12.6 s) | 0.500 | 0.595 |
| 40 | 0.797 (17.4 s) | 0.701 (12.0 s) | 0.716 | – |
| 100 | 0.879 (18.1 s) | 0.811 (14.6 s) | 0.825 | – |
| 256 | 0.936 (21.9 s) | 0.884 (15.6 s) | 0.891 | 0.942 |
What you see: Nobody changed a setting – and recall
at ef 10 drops from 0.585 to 0.473. Each segment has its
own signposts. With five segments, Milvus searches five times with
ef and merges the results: more candidates, higher recall,
a little slower. After the merge there is one big graph – and the values
are almost exactly those of pgvector with its single index. Qdrant with
three shards is at the level of the five segments. This clearly supports
the assumption from Day 13: the gap between pgvector and Qdrant comes
mainly from the number of graphs, not from a better algorithm.
Remember: recall depends not only on
ef, but also on how many graphs the holdings are split into – and that changes in the background. Only measure recall once compaction is done, and compare systems only at the same recall.
Save your progress? Sign up for free
Drill 7: Under load – 16 readers
Step 1 – the load generator. Built like
last-pg.py from Day 13: each process is a reader with its
own connection.
# on vdb1
nano last-milvus.py"""Lastgenerator für Milvus: jeder Prozess ist ein Leser mit eigener Verbindung."""
import sys
import time
from multiprocessing import Pool
import numpy as np
from pymilvus import MilvusClient
HOST, FRAGEN = sys.argv[1], sys.argv[2]
PARALLEL, ANZAHL, EF = int(sys.argv[3]), int(sys.argv[4]), int(sys.argv[5])
def leser(nummer):
"""Ein Prozess: schickt seine Anfragen nacheinander und gibt die Zeiten zurück."""
fragen = np.load(FRAGEN)
client = MilvusClient(uri=f"http://{HOST}:19530")
zeiten, fehler = [], 0
for i in range(nummer, ANZAHL, PARALLEL):
beginn = time.perf_counter()
try:
client.search("glove", data=[fragen[i % len(fragen)]], limit=10, anns_field="embedding",
search_params={"metric_type": "COSINE", "params": {"ef": EF}})
except Exception:
fehler += 1
zeiten.append((time.perf_counter() - beginn) * 1000)
return zeiten, fehler
if __name__ == "__main__":
start = time.perf_counter()
with Pool(PARALLEL) as pool:
ergebnisse = pool.map(leser, range(PARALLEL))
dauer = time.perf_counter() - start
zeiten = np.concatenate([z for z, f in ergebnisse])
fehler = sum(f for z, f in ergebnisse)
p50, p95, p99 = np.percentile(zeiten, [50, 95, 99])
print(f"parallel {PARALLEL} (Prozesse) · {ANZAHL} Anfragen in {dauer:.1f} s"
f" · {ANZAHL / dauer:.0f} Anfragen/s · p50 {p50:.1f} ms · p95 {p95:.1f} ms"
f" · p99 {p99:.1f} ms · max {zeiten.max():.1f} ms · Fehler {fehler}")| Argument | Example | Meaning |
|---|---|---|
sys.argv[1] |
10.43.241.133 |
IP of the milvus service |
sys.argv[2] |
../tag08/glove-fragen.npy |
the queries |
sys.argv[3] |
16 |
readers (processes) |
sys.argv[4] |
8000 |
total requests |
sys.argv[5] |
256 |
ef; with one segment recall 0.884 |
Step 2 – warm up, then measure. Measured after the merge, that is, with one segment.
# on vdb1
~/werkbank/bin/python last-milvus.py 10.43.241.133 ../tag08/glove-fragen.npy 16 2000 256Expected:
parallel 16 (Prozesse) · 2000 Anfragen in 3.6 s · 552 Anfragen/s · p50 23.0 ms · p95 41.2 ms · p99 53.3 ms · max 76.6 ms · Fehler 0
# on vdb1
~/werkbank/bin/python last-milvus.py 10.43.241.133 ../tag08/glove-fragen.npy 16 8000 256Expected:
parallel 16 (Prozesse) · 8000 Anfragen in 12.2 s · 656 Anfragen/s · p50 21.6 ms · p95 40.4 ms · p99 52.4 ms · max 85.5 ms · Fehler 0
Repeat the run once with 256 and once with
40.
Step 3 – Qdrant at the same hour. With the load generator from Day 11 (TLS and key):
# on vdb1
~/werkbank/bin/python ../tag11/last-prozesse.py https://10.43.151.237:6333 glove ../tag08/glove-fragen.npy 16 8000 128Expected (the version check warning from Day 10 omitted):
parallel 16 (Prozesse) · 8000 Anfragen in 24.6 s · 325 Anfragen/s · p50 38.0 ms · p95 79.0 ms · p99 111.6 ms · max 265.3 ms · Fehler 0
Expected – all runs with 8000 queries and 16 readers, workbench on vdb1 (raw output in the log; pgvector from Day 13):
| System | Search width | recall@10 | Requests/s | p50 | p95 | p99 |
|---|---|---|---|---|---|---|
| Milvus | ef 256 |
0.884 | 656 | 21.6 ms | 40.4 ms | 52.4 ms |
| Milvus | ef 256 |
0.884 | 639 | 21.8 ms | 41.0 ms | 55.5 ms |
| Milvus | ef 40 |
0.701 | 795 | 17.7 ms | 32.4 ms | 41.2 ms |
| Qdrant | hnsw_ef 128 |
0.901 | 325 | 38.0 ms | 79.0 ms | 111.6 ms |
| pgvector (Day 13) | ef_search 256 |
0.891 | 335–343 | 42.2–42.9 ms | 78.8–80.9 ms | 100.2–105.3 ms |
The conditions:
| Milvus | Qdrant | pgvector (Day 13) | |
|---|---|---|---|
| Location | 1 pod on vdb2, no CPU limit | 3 shards on vdb2 (8 vCPU), vdb3, vdb4 (2 vCPU each), 2 Gi per pod | 1 instance on vdb2, limit 6 CPU |
| Index | HNSW 16/100, 1 segment | HNSW 16/100, int8 with rescore | HNSW 16/100 |
| Connection | gRPC without TLS and without authentication | TLS, API key | TLS, password |
What you see: At comparable recall, Milvus handles about twice as many requests as the other two, with half the latency. But the comparison is not neutral: Milvus runs entirely on the strong node without a CPU limit and without TLS, while Qdrant is spread across two weak nodes with 2 vCPU each – on Day 8, a single Qdrant copy on vdb2 alone managed 365 requests per second. This run does not separate which share is due to hardware, TLS and software.
Remember: A comparison row names recall, hardware, distribution and encryption. If one of them is missing, you are measuring the environment, not the database.
Save your progress? Sign up for free
Drill 8: When does the reading room see a new book?
Milvus gives every change a timestamp. A search sees everything up to a point in time determined by the consistency level:
| Level | Sees | In the picture |
|---|---|---|
Strong |
everything up to the moment of the search | reading room waits until the accession register has been shelved |
Session |
everything this client has written itself | your own new acquisitions are there immediately |
Bounded |
everything up to a short time ago (default for a new collection) | reading room lags a little behind |
Eventually |
whatever is there right now | no waiting |
Step 1 – the probe script. It inserts a section and searches for it immediately. The vector is the opposite direction of an existing one – nothing like it exists in the holdings, so a hit with similarity 1.0 can only be the new one.
# on vdb1
nano konsistenz.py"""Fügt einen neuen Abschnitt ein und sucht sofort danach – mit der angegebenen Konsistenzstufe."""
import sys
import time
import numpy as np
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
neue_id, stufe = int(sys.argv[2]), sys.argv[3] # z. B. 900001 Bounded
vektor = -np.load("../tag01/vektoren.npy")[neue_id % 13220] # Gegenrichtung: gibt es so noch nicht
client.insert("doku", [{"id": neue_id, "bereich": "neu", "embedding": vektor}])
beginn = time.time()
ergebnis = client.search("doku", data=[vektor], limit=1, anns_field="embedding",
consistency_level=stufe, search_params={"metric_type": "COSINE"})
dauer = (time.time() - beginn) * 1000
bester = ergebnis[0][0]
print(f"{stufe:9} bester Treffer {bester['id']} (Abstand {bester['distance']:.4f})"
f" · gefunden: {bester['id'] == neue_id} · Suche {dauer:.0f} ms")Step 2 – four levels, four new sections.
# on vdb1
~/werkbank/bin/python konsistenz.py 10.43.241.133 900011 EventuallyExpected:
Eventually bester Treffer 4663 (Abstand -0.5621) · gefunden: False · Suche 25 ms
Repeat the command three times with the next ID and the next level:
900012 Bounded, 900013 Session,
900014 Strong.
Expected (the four output lines one below the other):
Eventually bester Treffer 4663 (Abstand -0.5621) · gefunden: False · Suche 25 ms
Bounded bester Treffer 900011 (Abstand 0.9090) · gefunden: False · Suche 13 ms
Session bester Treffer 900013 (Abstand 1.0000) · gefunden: True · Suche 209 ms
Strong bester Treffer 900014 (Abstand 1.0000) · gefunden: True · Suche 211 ms
What you see: With Eventually and
Bounded, the section just inserted is missing –
Bounded finds 900011 from the run one second earlier
instead. Session and Strong find it, but the
search takes a good 200 ms instead of 13 to 25 ms: Milvus waits until
the reading room has reached the timestamp. I measured the series twice,
with the same picture (log).
Step 3 – count and clean up.
# on vdb1
nano zaehlen.py"""Zählt die lebenden Zeilen einer Collection und sucht nach bestimmten IDs – mit Konsistenz Strong."""
import sys
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
name, ids = sys.argv[2], [int(i) for i in sys.argv[3:]] # z. B. doku 900100 900101
gesamt = client.query(name, filter="", output_fields=["count(*)"], consistency_level="Strong")
print("lebende Zeilen:", gesamt[0]["count(*)"])
if ids:
gefunden = client.query(name, filter=f"id in {ids}", output_fields=["id"], consistency_level="Strong")
print("gefunden:", sorted(z["id"] for z in gefunden))# on vdb1
~/werkbank/bin/python zaehlen.py 10.43.241.133 doku 900011 900012 900013 900014Expected:
lebende Zeilen: 13224
gefunden: [900011, 900012, 900013, 900014]
# on vdb1
nano entfernen.py"""Löscht Probe-Abschnitte aus doku – die IDs stehen auf der Befehlszeile."""
import sys
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
ids = [int(i) for i in sys.argv[2:]] # z. B. 900100 900101 900102
print(client.delete("doku", ids=ids))# on vdb1
~/werkbank/bin/python entfernen.py 10.43.241.133 900011 900012 900013 900014Expected:
{'delete_count': 4}
Remember: The default
Boundedis fast, but does not see your own writes immediately. If you write and read right afterwards, useSession– and pay with waiting time.
Save your progress? Sign up for free
Drill 9: Restart and closed stacks without power
Step 1 – delete the pod.
# on vdb1
kubectl -n milvus delete pod -l component=standalone-l component=standalone– selects the pod by its label, without the random name.
Expected (sent at 06:32:49):
pod "milvus-standalone-66668c74b5-fbdsz" deleted from milvus namespace
Right afterwards nobody is reachable; zustand.py ends
with Fail connecting to server on 10.43.241.133:19530 (in
the log).
# on vdb1
kubectl -n milvus wait --for=condition=Ready pod -l component=standalone --timeout=300sExpected (at 06:34:23 – a good one and a half minutes after deleting):
pod/milvus-standalone-66668c74b5-mvltw condition met
# on vdb1
~/werkbank/bin/python zustand.py 10.43.241.133 gloveExpected:
Ladezustand: Loaded
Zeilen : 1183514
Index : HNSW COSINE M 16 efConstruction 100 Status Finished 1183514/1183514
What you see: After the restart, both collections
are loaded again without you calling load. The load state
is in the catalog (etcd); data and index come from the closed stacks. 94
seconds without a response are the price of a single pod with
Recreate.
Step 2 – the probe script. One search and one insert, each with a 15 s timeout.
# on vdb1
nano probe.py"""Eine Suche und ein Einfügen mit je 15 s Zeitlimit – zeigt, was ohne Außenlager noch geht."""
import sys
import time
import numpy as np
from pymilvus import MilvusClient
client = MilvusClient(uri=f"http://{sys.argv[1]}:19530")
neue_id = int(sys.argv[2]) # z. B. 900101
vektor = np.load("../tag01/vektoren.npy")[3500]
for name, aufgabe in [
("Suche ", lambda: client.search("doku", data=[vektor], limit=1, timeout=15)),
("Einfügen", lambda: client.insert("doku", [{"id": neue_id, "bereich": "neu",
"embedding": -vektor}], timeout=15)),
]:
beginn = time.time()
try:
aufgabe()
print(f"{name} ok nach {time.time() - beginn:5.1f} s")
except Exception as fehler:
print(f"{name} Fehler nach {time.time() - beginn:5.1f} s: {str(fehler)[:110]}")# on vdb1
~/werkbank/bin/python probe.py 10.43.241.133 900100Expected:
Suche ok nach 0.1 s
Einfügen ok nach 0.2 s
Step 3 – cut the power to the closed stacks. You stop the off-site store. Qdrant is only affected for snapshots.
# on vdb1
sudo systemctl stop aussenlager# on vdb1
~/werkbank/bin/python probe.py 10.43.241.133 900101Expected (excerpt – the two result lines, the message shortened on the right; a long stack trace follows):
Suche ok nach 0.0 s
Einfügen Fehler nach 15.0 s: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.DEADLINE_EXCEEDED
# on vdb1
kubectl -n milvus get podsExpected:
NAME READY STATUS RESTARTS AGE
milvus-etcd-0 1/1 Running 0 25m
milvus-standalone-66668c74b5-mvltw 1/1 Running 0 2m59s
What you see: Reading continues – the reading room has everything in memory. Writing hangs until the timeout kicks in, because the accession register is in the closed stacks. And the pod reports itself as ready: the Kubernetes probe notices nothing.
Step 4 – power back on, and check. At 06:35:49:
# on vdb1
sudo systemctl start aussenlagerHalf a minute later (06:36:19):
# on vdb1
~/werkbank/bin/python zaehlen.py 10.43.241.133 doku 900100 900101Expected:
lebende Zeilen: 13221
gefunden: [900100]
# on vdb1
~/werkbank/bin/python probe.py 10.43.241.133 900102Expected:
Suche ok nach 0.0 s
Einfügen ok nach 2.8 s
And thirteen seconds after the first count (06:36:32):
# on vdb1
~/werkbank/bin/python zaehlen.py 10.43.241.133 doku 900100 900101 900102Expected:
lebende Zeilen: 13223
gefunden: [900100, 900101, 900102]
What you see: 900101 – the insert that ended with
DEADLINE_EXCEEDED – is there after all. Half a minute after
the closed stacks restarted, it was still missing. As with Qdrant on Day
7: a timeout means “result unknown”, not “not written”. Whoever resends
needs unique IDs so that nothing arrives twice.
# on vdb1
~/werkbank/bin/python entfernen.py 10.43.241.133 900100 900101 900102Expected:
{'delete_count': 3}
Remember: With Milvus, the object storage is not a backup target but part of the write path. If it fails, reading continues but writing stops – and the Kubernetes probe stays green.
Save your progress? Sign up for free
Drill 10: Cluster mode on paper
In cluster mode, every department gets its own pods. What that costs is in the chart’s defaults. You install nothing; you only let Helm generate the manifests.
Step 1 – the manifests into a file.
# on vdb1
helm template milvus milvus/milvus --version 5.0.35 -n milvus --set cluster.enabled=true > cluster-vorlage.yamlhelm template– generates the manifests locally without touching the cluster.--set cluster.enabled=true– otherwise all the chart’s defaults.
Step 2 – count. A small script reads the file and lists, per Deployment and StatefulSet, the pods, the memory request and the volumes.
# on vdb1
nano vorlage-zaehlen.py"""Liest eine von helm template erzeugte Datei und listet Pods, Speicheranforderung und Volumes."""
import sys
import yaml
for teil in yaml.safe_load_all(open(sys.argv[1])):
if not teil or teil["kind"] not in ("Deployment", "StatefulSet"):
continue
spec = teil["spec"]
speicher = [c.get("resources", {}).get("requests", {}).get("memory", "-")
for c in spec["template"]["spec"]["containers"]]
volumes = [v["spec"]["resources"]["requests"]["storage"]
for v in spec.get("volumeClaimTemplates", [])]
print(f'{teil["metadata"]["name"]:28} Pods {spec.get("replicas", 1)}'
f' Speicher {",".join(speicher):8} Volumes {" + ".join(volumes) or "-"}')# on vdb1
~/werkbank/bin/python vorlage-zaehlen.py cluster-vorlage.yamlExpected:
milvus-datanode Pods 1 Speicher - Volumes -
milvus-mixcoord Pods 1 Speicher - Volumes -
milvus-proxy Pods 1 Speicher - Volumes -
milvus-querynode Pods 1 Speicher - Volumes -
milvus-streamingnode Pods 1 Speicher - Volumes -
milvus-etcd Pods 3 Speicher - Volumes 10Gi
milvus-minio Pods 4 Speicher 2Gi Volumes 500Gi
milvus-pulsarv3-recovery Pods 1 Speicher 128Mi Volumes -
milvus-pulsarv3-bookie Pods 3 Speicher 2048Mi Volumes 100Gi + 200Gi
milvus-pulsarv3-broker Pods 2 Speicher 2048Mi Volumes -
milvus-pulsarv3-proxy Pods 2 Speicher 1024Mi Volumes -
milvus-pulsarv3-zookeeper Pods 3 Speicher 256Mi Volumes 20Gi
What you see (added up from the output):
| Cluster mode with defaults | this lab | |
|---|---|---|
| Pods | 23 (5 Milvus, 3 etcd, 4 MinIO, 11 Pulsar) | – |
| requested memory | about 20.9 GiB (excluding Milvus and etcd, which request nothing) | 44 GB RAM on four VMs |
| requested volumes | about 2990 GiB (4 × 500 Gi MinIO, 3 × 300 Gi Bookie, 3 × 10 Gi etcd, 3 × 20 Gi ZooKeeper) | 77 + 80 (+ 20) + 30 + 30 GB disk |
With the defaults, cluster mode does not fit into this lab – the
volumes alone exceed the disk space more than tenfold. That is why I did
not measure it. Also striking: the five Milvus departments request
no memory and no CPU. Without requests, the scheduler
cannot plan, and under pressure they are evicted first – in production
you set your own resources for each department.
For the decision between standalone and cluster, what counts is: standalone is one pod that goes down with every update and every node failure (Drill 9: 94 s). Cluster mode spreads the reading room and information desk across several pods and scales them individually – in return you also operate etcd, object storage and, depending on your choice, Pulsar or Kafka.
Step 3 – without Pulsar. As today in standalone, you switch off Pulsar; Woodpecker is the default.
# on vdb1
helm template milvus milvus/milvus --version 5.0.35 -n milvus --set cluster.enabled=true --set pulsarv3.enabled=false > cluster-woodpecker.yaml# on vdb1
~/werkbank/bin/python vorlage-zaehlen.py cluster-woodpecker.yamlExpected:
milvus-datanode Pods 1 Speicher - Volumes -
milvus-mixcoord Pods 1 Speicher - Volumes -
milvus-proxy Pods 1 Speicher - Volumes -
milvus-querynode Pods 1 Speicher - Volumes -
milvus-streamingnode Pods 1 Speicher - Volumes -
milvus-etcd Pods 3 Speicher - Volumes 10Gi
milvus-minio Pods 4 Speicher 2Gi Volumes 500Gi
What you see: The eleven Pulsar pods are gone; 12
remain. With an external object storage instead of MinIO
(minio.enabled: false, as today) it is 8 – five departments
and three etcd (cross-checked, in the log).
Remember: Cluster mode buys scaling and resilience with many parts. Work it out beforehand with
helm template– pods, memory, volumes – instead of trying it out.
Save your progress? Sign up for free
Three libraries compared
All values come from this lab (vdb1–vdb4, k3s, Longhorn) with
glove-100 (1,183,514 × 100, cosine) and HNSW m 16 / 100.
Where they come from is in the last column.
| Qdrant | pgvector | Milvus | Source | |
|---|---|---|---|---|
recall@10 at ef 256 |
0.942 (3 shards) | 0.891 | 0.884 (1 segment), 0.936 (5 segments) | Day 8, 13, 14 |
| Requests/s at recall ≈ 0.89, 16 readers | 325–400 | 335–343 | 639–656 | Day 13, 14 |
| Distribution in the run | 3 pods on 3 nodes | 1 pod on vdb2 | 1 pod on vdb2 | |
| Loading until searchable | 197 s + a good 4 min | 44 s + 8:13 min index | approx. 5:07 min | Day 8, 13, 14 |
| Memory in operation | 436–549 Mi per pod (all collections) | limit 6 Gi, usage not measured | 910 Mi (doku + glove loaded) | kubectl top, Day 13, 14 |
| Space for glove | about 670 MiB on the volumes (with int8) | 539 MB table + 841 MB HNSW | 3.2 GiB in S3 (with old segments and WAL) | Day 9, 13, 14 |
| Pods in the lab | 3 | 1 + operator | 2 (Milvus, etcd) + S3 | |
| Multiple nodes | shards, replicas, Raft built in | solve it yourself (replicas for reading only) | cluster mode, many components | |
| Backup | snapshots per shard to S3 (Day 12) | CNPG backup, PostgreSQL tools | back up etcd + object storage together | |
| Security out of the box | open without a key | password, TLS | open without authentication
(authorizationEnabled: false) |
Day 10, 13, 14 |
On Milvus’s storage space: at the end, the bucket held 1.4 GiB of
data (insert_log), 1.3 GiB of indexes and 515 MiB of
write-ahead log. The files of the five original segments were still
there alongside the merged one – which fits the multiple compared with
about 0.5 GB of raw vectors. I did not wait to see when Milvus cleans
them up.
When to use what? pgvector, if PostgreSQL is running anyway and the vectors should be in one transaction with business data. Qdrant, if a dedicated system with built-in distribution and manageable operations is needed. Milvus, if the data volume goes beyond what a few nodes can hold, and a team can operate etcd, object storage and many components.
Diagnosis task: 13,234 rows instead of 13,220
A colleague reports: “The monitoring shows 13,234 rows for
doku. We have 13,220 sections. Did someone import data
twice?”
# on vdb1
~/werkbank/bin/python zustand.py 10.43.241.133 dokuExpected:
Ladezustand: Loaded
Zeilen : 13234
Index : HNSW COSINE M 16 efConstruction 100 Status Finished 13220/13220
Find the cause before you read on. Tools: zaehlen.py,
segmente.py and your notes from Drill 8 and 9.
Solution path.
Step 1 – count the live rows.
# on vdb1
~/werkbank/bin/python zaehlen.py 10.43.241.133 dokuExpected:
lebende Zeilen: 13220
Step 2 – the segments.
# on vdb1
~/werkbank/bin/python segmente.py 10.43.241.133 dokuExpected:
470951531148631503 13220 Sealed
1 Segmente, 13220 Zeilen
Cause: Nobody imported twice.
get_collection_stats counts the rows stored in sealed
segments – including deleted ones. 14 probe sections from the
consistency experiments (I had more runs than in the book) were already
sealed when they were deleted; in Milvus a deletion only writes a delete
marker. The query count(*) with Strong applies
the markers and counts what is really there.
Afterwards I compacted by hand (client.compact("doku"),
in the log). The statistics rose to 13,241 because the remaining probe
sections were sealed in the process as well – the delete markers were
not applied immediately. I did not wait to see when they physically
disappear.
Solution: Use count(*) for dashboards
and reconciliations, not row_count from the statistics. The
statistics show how much is stored – that is right for capacity
planning, but not for the number of records.
Checkpoint
The count from the diagnosis task is your first checkpoint:
doku has 13,220 live rows, all probe sections are deleted.
glove has been Loaded with 1,183,514 rows
since Drill 9.
Day 15 needs the resources for Argo CD and Qdrant upgrades. That is why you take Milvus down again.
# on vdb1
helm -n milvus uninstall milvusExpected:
These resources were kept due to the resource policy:
[PersistentVolumeClaim] milvus
release "milvus" uninstalled
# on vdb1
kubectl -n milvus get pvcExpected:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
data-milvus-etcd-0 Bound pvc-63d294a0-333b-4bb6-b2bd-00257681f0a7 2Gi RWO longhorn <unset> 30m
milvus Bound pvc-0dd8e147-91ad-468c-8aad-037caa0f2f99 10Gi RWO longhorn <unset> 30m
What you see: Both volumes remain: the pod’s because
of helm.sh/resource-policy: keep in the chart, etcd’s
because Helm never deletes the volumes of a StatefulSet. If you
reinstalled Milvus under the same name, it would find the old catalog
again – and look for data in the bucket. Only deleting the namespace
removes both.
# on vdb1
kubectl delete namespace milvus# on vdb1
~/werkbank/bin/aws --profile verwalter s3 rb s3://milvus-daten --forcerb– “remove bucket”;--forcefirst deletes all objects in it.
Expected (excerpt – the last two lines):
delete: s3://milvus-daten/bibliothek/wp/9/2/write.lock
remove_bucket: milvus-daten
You remove Milvus’s badge from the off-site store again, using the backup from Drill 1:
# on vdb1
sudo cp /etc/seaweedfs/s3.json.vor-tag14 /etc/seaweedfs/s3.json# on vdb1
sudo systemctl restart aussenlager# on vdb1
~/werkbank/bin/aws --profile verwalter s3 lsExpected:
2026-12-06 02:20:05 qdrant-sicherung
# on vdb1
rm s3-geheim-milvus s3-geheim-milvus.einzeilig# on vdb1
sudo rm /etc/seaweedfs/s3.json.vor-tag14# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io -o custom-columns=NAME:.metadata.name,STATE:.status.state,ROBUST:.status.robustnessExpected: the four volumes from before again (Ollama
and three Qdrant pods), all attached and
healthy.
NAME STATE ROBUST
pvc-1be489ab-3891-4c08-b4b4-b3d91dac36d9 attached healthy
pvc-37095780-0d56-4966-a719-884783ff8977 attached healthy
pvc-c6c96e89-073d-4b27-baae-13ed36b72ef8 attached healthy
pvc-e760fa38-f3f3-446d-9edc-6453b63e6b61 attached healthy
Test yourself
- A search ends with
collection not loaded, even thoughinsertran without errors. What is missing, and in which order do you catch up? - You measure recall right after loading and an hour later, without changing anything – and get different values. Why?
- A service writes a record and searches for it immediately, but does not find it. Which setting do you check, and what does the remedy cost?
- The off-site store fails. What still works in Milvus, what does not, and what does the Kubernetes probe show?
- An insert ends with
DEADLINE_EXCEEDED. May the application assume that it was not written? - Why is the S3 key still readable by many people after an
installation with
--set-file?
Answers:
- Index and
load: firstflush(seal growing segments), thencreate_index, thenload_collection. Without an index, Milvus refuses to load (index not found). - The segments. Right after loading there were five segments, each
with its own graph; after compaction there was one. More graphs mean
more candidates: recall 0.585 instead of 0.473 at
ef10. - The consistency level.
Bounded(default) andEventuallydo not see fresh inserts immediately.SessionorStrongfind them, but the search then took about 210 instead of 13 to 25 ms. - Searches continue because the reading room has everything in memory.
Inserts hang until the timeout because the write-ahead log is in the
object storage. The pod stays
1/1 Running– the probe notices nothing. - No. 900101 ended with
DEADLINE_EXCEEDEDand was still not there half a minute after the closed stacks restarted – thirteen seconds later it was. A timeout means “unknown”; resend only with the same ID. - The chart writes it in plain text into the ConfigMap
milvus, and Helm into its release Secret. Anyone allowed to read ConfigMaps in the namespace has the key.
Interview note
“Qdrant, pgvector or Milvus – how do you decide?” – By data
volume, operational effort and measured recall, not by benchmarks from
the internet. In my lab with glove-100, all three were in the same order
of magnitude at recall around 0.89; Milvus was twice as fast on the
strongest node without TLS, which I could not cleanly separate from the
hardware. Operations were more interesting: Milvus puts data and its
write-ahead log into the object storage – if S3 fails, reading continues
but writing stops, and the Kubernetes probe stays green. New data is
only searchable after flush, index and load, and the
default Bounded does not show your own writes immediately.
And I learned that recall depends on the number of graphs: at the same
search width, five segments returned considerably more hits than
one.
Enterprise note
In production, Milvus runs in cluster mode with at least two proxies
and QueryNodes, resources for every department, etcd with
three members on their own volumes, and an object storage that is itself
highly available – it is in the write path. The credentials do not go
into a ConfigMap via externalS3, but come via an identity
(useIAM) or a separate configuration from a Secret. You
switch on authentication
(common.security.authorizationEnabled: true) and TLS; you
change the default root password Milvus immediately.
For backups there is the tool milvus-backup: it backs up
catalog and objects together, because etcd without matching files – or
vice versa – is worthless. Also check when Milvus removes old segment
files from the bucket; until then they take up space. Application teams
and operations agree on consistency levels beforehand:
Bounded for searches, Session for workflows
that must see their own changes immediately.
Summary
- Milvus 3.0.7 (chart 5.0.35) as standalone on vdb2: one pod
(
milvus run standalone,Recreate) plus etcd, Woodpecker embedded, object storage = bucketmilvus-datenin the off-site store; Pulsar, MinIO and cluster mode switched off. Ready after about three minutes. - The S3 key is in plain text in the ConfigMap
milvus. The local volume stays almost empty (36 KB). - doku: 10.9 s insert; search before that
collection not loaded, statistics 12,000 instead of 13,220 (growing segment); flush 1.7 s, index 7.5 s, load 2.5 s. - glove: 132.7 s insert (8918/s), flush 2.7 s, index 167.5 s, load 4.0 s – approx. 5:07 min until searchable, followed by a good five minutes of compaction with up to 6.6 cores.
- recall@10 at
ef10/40/100/256: 0.585/0.797/0.879/0.936 with five segments, 0.473/0.701/0.811/0.884 with one – almost the same as pgvector; the number of graphs explains the gap from Day 13. - 16 readers at recall 0.884: 639–656 requests/s (p99 52–56 ms); Qdrant at the same hour 325, pgvector (Day 13) 335–343 – under unequal conditions (nodes, TLS).
- Consistency:
EventuallyandBoundeddo not see your own insert,SessionandStrongdo, at about 210 instead of 13–25 ms. - Restart: 94 s without a response, collections loaded automatically afterwards.
- Off-site store down: search ok, insert
DEADLINE_EXCEEDEDafter 15 s, pod stays ready; the aborted insert appeared later after all. - Cluster mode with defaults: 23 pods, about 20.9 GiB memory and 2990
GiB volume requests – not installed. Milvus departments without
resources. row_countcounts stored rows including delete markers;count(*)withStrongcounts the live ones.- Taken down: release, namespace (both PVCs), bucket, badge; Qdrant unchanged, four Longhorn volumes healthy.
Commands at a glance
| Command | Purpose |
|---|---|
helm repo add milvus https://zilliztech.github.io/milvus-helm/ |
Milvus chart repository |
helm show values milvus/milvus --version <v> |
the chart’s defaults |
helm install … --set-file <key>=<file> |
set a value from a file |
helm template … --set cluster.enabled=true > <file> |
generate manifests without installing |
kubectl -n milvus logs deploy/milvus-standalone |
log of all departments |
kubectl -n milvus get configmap milvus -o jsonpath='{.data.default\.yaml}' |
generated configuration |
aws --profile <p> s3 mb s3://<bucket> /
s3 rb s3://<bucket> --force |
create bucket / delete it including content |
MilvusClient(uri=…) |
connection from Python (pymilvus) |
create_schema, add_field,
create_collection |
create a collection with a schema |
insert, delete, flush |
write, delete, seal |
prepare_index_params, add_index,
create_index |
build an index |
load_collection, get_load_state |
fetch into the reading room, load state |
search(…, search_params={"params": {"ef": …}}, consistency_level=…) |
search with search width and consistency level |
query(…, output_fields=["count(*)"], consistency_level="Strong") |
count live rows |
get_collection_stats,
list_loaded_segments |
stored rows, segments |
systemctl stop / start aussenlager |
practice an object storage outage |