qdrant-client icon indicating copy to clipboard operation
qdrant-client copied to clipboard

Search Groups Timed Out

Open Schneipi opened this issue 11 months ago • 7 comments

Concerning Qdrant server:

I'm currently trying to replace client.search() with client.search_groups() in my application. I want to retrieve text documents based on vector similarity and I would like to have the ability to return all chunks of the concerneed documents (long documents were split into multiple chunks). The method search_groups() seems like the perfect solution, however a qdrant_client.http.exceptions.ResponseHandlingException: timed out exception is now always raised.

The collection has approximately 10 million vectors. Running client.search() works perfectly. Is client.search_groups() this much more expensive to compute, and therefore times out? Any ideas to workaround this? Thanks.

Schneipi avatar Jul 18 '23 09:07 Schneipi

Hello @Schneipi which version of Qdrant are you running? With the latest versions it might be useful to create a payload field index for the field you are grouping by (e.g. document_id)

joein avatar Jul 18 '23 09:07 joein

Thanks for the reply and advice!

I am running Qdrant 1.3.0. I created a payload field index for my document_id field. However, the qdrant_client.http.exceptions.ResponseHandlingException: timed out exception still presists.

Schneipi avatar Jul 25 '23 10:07 Schneipi

It seems to work now. I added a timeout value when initalizing QdrantClient:

client= QdrantClient(host=ct.QDRANT_HOST, grpc_port=ct.QDRANT_GRPC_PORT, timeout=Timeout(timeout=TIMEOUT_SECS))

Queries seem much slower, but the timed out exception is gone now.

Schneipi avatar Aug 01 '23 13:08 Schneipi

@Schneipi could you please share some more information about your environment, so we could try to help with timeouts:

  • What's your collection info looks like?
  • What query are you running? Is there any additional filtering conditions? What's the limit?
  • What's your hardware? If you use on_disk or mmap option, what's disk iops?

generall avatar Aug 01 '23 13:08 generall

Collection info:

status=<CollectionStatus.GREEN: 'green'> optimizer_status=<OptimizersStatusOneOf.OK: 'ok'> vectors_count=9552941 indexed_vectors_count=9552941 points_count=9552941 segments_count=38 config=CollectionConfig(params=CollectionParams(vectors=VectorParams(size=1536, distance=<Distance.COSINE: 'Cosine'>, hnsw_config=None, quantization_config=None, on_disk=True), shard_number=1, replication_factor=1, write_consistency_factor=1, on_disk_payload=True), hnsw_config=HnswConfig(m=16, ef_construct=100, full_scan_threshold=10000, max_indexing_threads=0, on_disk=True, payload_m=None), optimizer_config=OptimizersConfig(deleted_threshold=0.2, vacuum_min_vector_number=1000, default_segment_number=0, max_segment_size=None, memmap_threshold=20000, indexing_threshold=20000, flush_interval_sec=5, max_optimization_threads=1), wal_config=WalConfig(wal_capacity_mb=32, wal_segments_ahead=0), quantization_config=None) payload_schema={}

The only query that I need to run, is the following one:

new_results = client.search_groups(
	collection_name=coll_name,
	query_vector=embedding,
	group_by="document_id",
	limit=12,
	group_size=10,
)

Hardware is running Ubuntu using an 8-core CPU with 24 GB of RAM. The observed r/s while running the query is 64k, w/s is 24k.

Thanks for the help.

Schneipi avatar Aug 03 '23 11:08 Schneipi

Hello, I also sometimes get the same error (qdrant_client.http.exceptions.ResponseHandlingException: timed out) when running successive client.scroll() commands (ie continually calling scroll() and setting the offset based on the next_page_offset sent by the previous page of results).

The error occurs only sometimes (and other times the code is successful), so I suspect it is truly something to do with the server or server response, but I am not sure how to diagnose it or mitigate it. Especially as I dont want to introduce a lot of waiting, since the pagination of scroll is very small (10 records at a time!) and I wish to receive 100s of filter hits.

Looking in the backtrace it is actually caused by this exception:

  File "C:\...\venv\Lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ReadTimeout: timed out

During handling of the above exception, another exception occurred:

I don't know enough to track down if it is the same as the observation in this comment: https://github.com/qdrant/qdrant-client/issues/79#issuecomment-1513174348

tamaravasey avatar Aug 22 '23 14:08 tamaravasey

happened in 1.8.0, update to 1.9.0 it's fixed

sevenjay avatar Apr 26 '24 03:04 sevenjay