mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
eff75c7701
Signed-off-by: Binbin Lv <binbin.lv@zilliz.com>
31 lines
676 B
Python
31 lines
676 B
Python
|
|
import random
|
|
from locust import HttpUser, task, between
|
|
|
|
|
|
collection_name = "random_1m_2048_512_ip_sq8"
|
|
headers = {'Content-Type': "application/json"}
|
|
url = '/collections/%s/vectors' % collection_name
|
|
top_k = 2
|
|
nq = 1
|
|
dim = 512
|
|
vectors = [[random.random() for _ in range(dim)] for _ in range(nq)]
|
|
data = {
|
|
"search":{
|
|
"topk": top_k,
|
|
"vectors": vectors,
|
|
"params": {
|
|
"nprobe": 1
|
|
}
|
|
}
|
|
}
|
|
|
|
class MyUser(HttpUser):
|
|
wait_time = between(0, 0.1)
|
|
host = "http://192.168.1.112:19122"
|
|
|
|
@task
|
|
def search(self):
|
|
response = self.client.put(url=url, json=data, headers=headers, timeout=2)
|
|
print(response)
|