qdrant server windows builds are extremely slow (100-1000x slower) than Mac builds
I'm testing my code that runs great on MacOS Intel (after fixing file limit) to windows. All the code seems to run correctly, however the queries are extremely slow.
Current Behavior
Here's some rundown of how slow the database is on windows:
- Creating a new index (6.7 seconds), originally was getting a timeout error on my python client until I raised it to 100 seconds
- Performing a search - performing a search on a collection with zero points takes 2.04 seconds with no hits of course
- Loading points, I'm using upload_records and it only uploads about 64/second which is a hundred times slower than on Mac
Interestingly the logs for the database are fine, suggesting query times of 0.00066 seconds but the queries are still taking many seconds. This is not the case for index creation which the qdrant logs show taking 6+ seconds.
Steps to Reproduce
I have a quick class here that can be used to see the behavior:
ENTRIES = 100000
class Qdrant:
def __init__(self):
# db_location = get_shade_root() / "search.db"
# self.client = QdrantClient(path=str(db_location))
self.client = QdrantClient(url="http://localhost:6333", timeout=1000)
# Check to make sure that the "everything" collection exists
collections = self.client.get_collections()
collection_names = [desc.name for desc in collections.collections]
if "everything" not in collection_names:
self.create_collection()
# Get the number of entries in the collection
collection_info = self.client.count("everything")
print("Finished setup with {} entries".format(collection_info.count))
def reset(self):
print("Deleting Collection")
self.client.delete_collection("everything")
print("Creating Collection")
self.create_collection()
self.preload()
def search(self, vector):
# self.client.create_payload_index(collection_name='everything', field_name='type')
start_time = time.time()
hits = self.client.search(
collection_name="everything",
query_vector=vector,
query_filter=Filter(
must=[
FieldCondition(
key="type",
match=MatchValue(
value='image'
)
)
]
),
limit=10,
)
print(f"Time taken {time.time() - start_time} with {len(hits)} hits")
# for hit in hits:
# print(hit)
def create_collection(self):
# Create collection everything
self.client.create_collection(
collection_name="everything",
vectors_config=VectorParams(size=100, distance=Distance.DOT)
)
def preload(self):
vectors = np.random.rand(ENTRIES, 100)
vectors_list = vectors.tolist()
print('generating records')
generated_records = [
Record(
id=str(uuid.uuid4()),
vector=vectors_list[i],
payload={
'type': 'image' if i % 2 == 0 else 'video'
}
) for i in range(ENTRIES)
]
print("loading db")
self.client.upload_records(
collection_name='everything',
records=generated_records
)
if __name__ == "__main__":
db = Qdrant()
db.reset()
while True:
db.search([0.1] * 100)
Expected Behavior
Should be the same speed as other platforms.
Context (Environment)
Intel Mac running Windows Bootcamp This doesn't appear to be due to the python client because connecting to a build running on linux over LAN runs at normal speeds.