Hi, I’m struggling with a latency issue with OpenSearch.
My documents for the index are fairly small (< 1G) and I’ve indexed them with the following setting using python.
"number_of_shards": 2,
"number_of_replicas": 1,
However, OpenSearch is giving me about 30ms per query to retrieve the search results (os.search()). Furthermore, just to check if the index exists or not takes me about 10ms (es.indices.exists(index=index_name)), which is way slower than I expected OpenSearch to be.
Any feedback to help look further into this issue would be appreciated.
p.s. I’ve tried changing the number of shards in the configuration to see if it helps but it didn’t help. My OpenSearch server is set with AWS and I’m wondering if there’s anything I could do from the client-side (local machine where I’m performing indexing and searching) to boost up the speed.
That’s actually rather low. Are these times including network, processing, etc… Or are these the times reported by Opensearch in the “took” field of the response? I am not entirely sure you can go much lower on a non local server using HTTP
I see. I guess I expected a faster inference speed on OpenSearch. Actually, the average value of the “took” field of the responses is reported as 10ms. The 30ms I reported earlier is the time I measured for the round trip of the search on Python. Where does the discrepancy come from?
This isn’t related to Opensearch. Any round trip based on TCP (which is the underlying protocol of HTTP) can take some time and is mostly related to the underlying network.
Python itself also take some time to actually parse the raw response.
Basically, don’t expect any database whatsoever to take less than 10ms over TCP, and take the network round-trip (time to send the request+time to get the response) into account.
If you’re looking for speeds below 10ms you’re using entirely the wrong tools.
Depending on your use case however, async programming was was invented precisely for the kind of wait network requests entail.
I not specifically looking for any tool for speeds below 10ms but I just wanted to make sure that the speeds I’m getting are absolutely normal for OpenSearch. Thank you for your explanation.