Open yhmo opened 2 months ago
Standalone by docker-compose.
docker stats
to observe memory usage.
My test results in different versions:
Milvus version | Memory usage |
---|---|
2.3.13 | 5.9GB |
2.4.1 | 6.0GB |
2.4.6 | 5.0GB |
2.4.9 | 5.2GB |
this might be related to chunk size. each segment has a maximum chunk size. tuning that parameter might work.
this might be related to chunk size. each segment has a maximum chunk size. tuning that parameter might work.
I only saw "queryNode.segcore.chunkRows", the default value is 128(rows).
@yhmo can you try to limit the memory to 2GB and see if milvus can still hold so many collections? /assign @congqixia please keep an eye on this /unassign
@yhmo can you try to limit the memory to 2GB and see if milvus can still hold so many collections? /assign @congqixia please keep an eye on this /unassign
Set memory limit to 2GB. Memory quota limit is hit at the No.77 insert batch: <MilvusException: (code=9, message=quota exceeded[reason=memory quota exceeded, please allocate more resources])>
5000 77 512 * 4bytes = 751MB data is inserted.
you get memory consumption since:
The index type is FLAT, so no index node is involved. The interim index is built on query node.
I add a line to flush each collection after insertion. And rerun the script, the memory usage is 1.44GB, which is expected. So the point is why the memory usage is so high when data is in growing segment.
batch = 5000
for i in range(100):
data = [
[[random.random() for _ in range(dim)] for _ in range(batch)]
]
collection_name = "col_" + str(i%col_cnt)
collection = Collection(collection_name)
collection.insert(data=data)
print("insert", i)
collection.flush()
maybe you can disable interim index and check?
maybe you can disable interim index and check?
Seems is not caused by the interim index. I just re-tested with disabled/enabled interim index. The memory usage is 5.xGB after finishing insertion(without flush). And a few minutes later, the memory usage fell to 2.5GB.
another thing to think about is memory allocator params. Sometimes it's just some temporary memory usage and memory allocator didn't release those memory into operating system
/assign @cqy123456 please help an eye on this, as you are developing interim index
The index type is FLAT, so no index node is involved. The interim index is built on query node.
I add a line to flush each collection after insertion. And rerun the script, the memory usage is 1.44GB, which is expected. So the point is why the memory usage is so high when data is in growing segment.
batch = 5000 for i in range(100): data = [ [[random.random() for _ in range(dim)] for _ in range(batch)] ] collection_name = "col_" + str(i%col_cnt) collection = Collection(collection_name) collection.insert(data=data) print("insert", i) collection.flush()
I thought this could probably becasue soem of the data structure in growing segemnt is different, for example pk index(guess that's the main reason.) we might need jemalloc to check the memory usage
FLAT will not build interim index
I used the above script to test locally, and the intermin index had almost no impact on memory usage(index type = Flat). The peak memory before the system is stable is about 5.2GB, and the memory after stabilization is 2.8GB. Use distributed milvus for memory analysis:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen
.
Is there an existing issue for this?
Environment
Current Behavior
vector dimension=512 index type: FLAT 100 collections, 5000 vectors per collection, raw data size = 512 4 5000 * 100 = 1GB the memory usage is > 5GB
Expected Behavior
Memory usage is 5X compared to raw data size, which is terrible. I suppose it should be no more than 2GB.
Steps To Reproduce
Run this script to observe: