# Where is the bottleneck of KNN retrieval speed? How to analyze?

**URL:** <https://discuss.elastic.co/t/where-is-the-bottleneck-of-knn-retrieval-speed-how-to-analyze/347269>\
**Category:** Elasticsearch\
**Tags:** vector-search\
**Created:** [November 16, 2023, 4:05am UTC](https://discuss.elastic.co/t/where-is-the-bottleneck-of-knn-retrieval-speed-how-to-analyze/347269 "2023-11-16T04:05:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lack](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@Lack](https://discuss.elastic.co/u/Lack)\
**Post date:** [November 16, 2023, 4:05am UTC](https://discuss.elastic.co/t/where-is-the-bottleneck-of-knn-retrieval-speed-how-to-analyze/347269/1 "2023-11-16T04:05:02Z")

</div>

I have three data nodes, configured as 16 core 64g, with an index of about 19million documents, including 768 dimensional vector fields. The number of fragments is 24, the number of copies is 1, and the total size includes about 600g copies. Currently, it is retrieved by KNN, k=10, num\_ Candidates=50, the retrieval time is about 20~30 seconds, and the retrieval time after caching is about 10~20 seconds. How to optimize the retrieval speed to within 10 seconds? What is the bottleneck of current retrieval? I think the current CPU utilization rate is usually less than 25%. How can we make full use of CPU resources? Or how can I analyze the memory usage and CPU usage in a query process?

---

<div class="post-metadata">

**Author:** ![Serena\_Chou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/serena_chou/32/100087_2.png) [@Serena\_Chou](https://discuss.elastic.co/u/Serena_Chou)\
**Post date:** [November 16, 2023, 4:25am UTC](https://discuss.elastic.co/t/where-is-the-bottleneck-of-knn-retrieval-speed-how-to-analyze/347269/2 "2023-11-16T04:25:20Z")

</div>

> **[Identify slow queries in generative AI search experiences](https://www.elastic.co/blog/slow-queries-generative-ai-search-experiences)**
>
> Uncover the power of Elasticsearch tracing and optimize your APM with insights into query times, bulk indexing, and machine learning impacts. Master semantic search and enhance performance for data-driven decisions.

---

<div class="post-metadata">

**Author:** ![Thijsvdp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thijsvdp/32/146696_2.png) [@Thijsvdp](https://discuss.elastic.co/u/Thijsvdp)\
**Post date:** [November 16, 2023, 11:44pm UTC](https://discuss.elastic.co/t/where-is-the-bottleneck-of-knn-retrieval-speed-how-to-analyze/347269/3 "2023-11-16T23:44:41Z")

</div>

I have recently answered a question, which is similar to your problem. Please check this: [link](https://discuss.elastic.co/t/ann-search-is-super-slow/344863/5).

Hope it helps!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 14, 2023, 11:45pm UTC](https://discuss.elastic.co/t/where-is-the-bottleneck-of-knn-retrieval-speed-how-to-analyze/347269/4 "2023-12-14T23:45:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
