How to config cache size? #27715
-
The more I add vectors to the database, the more RAM memory increases. In the configuration file config, how can I modify it to limit the memory size (eg: 2GB) when running, and when the data has filled 2GB of RAM, I want all the remaining data to be saved on disk. Or anywhere I can modify? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
When you continually insert vectors into milvus:
So, then you insert vectors, querynode's memory increases, datanode's memory remains at low level. That is to say, "high memory usage" has nothing to do with "data persist". If you don't want to search the collection, just call collection.release() to free the memory. But once you have call collection.load(), you must ensure the querynode's memory can hold the entire collection, otherwise you will not able to search. queryNode.cacheSize cannot save memory. As we know, querynode reads data from s3/minio, the data is read into querynode's memory. If you call collection.release() and call collection.load() again, it will read s3/minio again. Read data from s3/minio is time consuming, the queryNode.cacheSize allows the querynode download the files to the local disk. The next time you call collection.load(), querynode can read the data from local disk, much faster than reading from s3/minio. So, queryNode.cacheSize is "the max size to cache data into local disk". |
Beta Was this translation helpful? Give feedback.
-
Hello, @yhmo I am using version 2.3.12, I understood the following:
Is this correct? |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your answer. |
Beta Was this translation helpful? Give feedback.
The milvus v1.x can swap data between memory and disk. If the data size is larger than the cache size, it can load/release segments one by one to search. Once the cache is full, it releases a segment and reads the next segment from the hard disk to search. Since reading data from a hard disk is much slower than from memory, the search performance is very poor. Only when the data size is less than cache size, the search performance is the best.
Milvus v2.x doesn't support swapping data between memory and disk. It requires the target collection must be fully loaded into memory before searching.
The milvus v1.x C++ sdk is here https://github.com/milvus-io/milvus/tree/1.1/sdk, it is inside th…