pymilvus
pymilvus copied to clipboard
[QUESTION]: When I use multiple threads to request Milvus' data, why do I have good QPS growth for 1,2,3 threads, but no QPS growth for more than 3 threads?
Is there an existing issue for this?
- [X] I have searched the existing issues
What is your question?
When I use multiple threads to request Milvus' data, why do I have good QPS growth for 1,2,3 threads, but no QPS growth for more than 3 threads? Standalone version using Docker deployment. Start with standalone_embed.sh without the user.yaml file.
def multi_query(self, X: numpy.array, n: int, num_threads: int):
if not self.collection:
self.collection = Collection(self.collection_name, consistence_level="STRONG")
self.load_collection()
total_count = len(X)
per_count = total_count / 10
def single_query(idx, v, n):
try:
# conn = conn_pool.get_connection()
start = time.time()
results = self.collection.search(
data=[v.tolist()],
anns_field="vector",
param=self.search_params,
limit=n,
output_fields=["id", "vector"])
total = time.time() - start
res = [(v, r.entity.get("id"), r.entity.get("vector")) for r in results[0]]
if (idx + 1) % per_count == 0:
print(
f"Read Processed: {round((idx + 1) / total_count * 100, 1)}%,Complete:{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}")
return (start, total, res)
except Exception as e:
print(f"Error executing query: {e}")
return None
# finally:
# if conn is not None:
# conn_pool.release_connection(conn)
with ThreadPoolExecutor(max_workers=num_threads) as pool:
results = pool.map(lambda idx_v: single_query(idx_v[0], idx_v[1], n), enumerate(X))
self.res = [result for result in results if result is not None]
Anything else?
No response