为什么当我使用SOLR查询所有文档时CPU使用率接近100%

发布于 2024-11-03 03:33:37 字数 759 浏览 5 评论 0原文

我有一个使用 SOLR 查询 200 万以上文档并按时间排序的应用程序。 查询URL参数像这样/select?sort=p_review_date desc&rows=10&start=0&q=*:*,参数start是变量值,每个请求增加10。 当我进行性能压力测试时,SOLR服务器CPU使用率接近100%。

问题: 1.CPU占用率高的原因是什么? 2.有没有办法让CPU占用率降低,比如缓存或者其他配置。

这是 solrconfig.xml 中查询缓存配置的一部分 1024

<queryResultCache
    class="solr.LRUCache"
    size="40960"
    initialSize="10240"
    autowarmCount="512"/>

<documentCache
    class="solr.FastLRUCache"
    size="40960"
    initialSize="10240"
    autowarmCount="0"/>

<enableLazyFieldLoading>true</enableLazyFieldLoading>

<queryResultWindowSize>10</queryResultWindowSize>

<queryResultMaxDocsCached>500</queryResultMaxDocsCached>

I have a application using SOLR to query 2 million+ document and sort by time.
Query URL param like this /select?sort=p_review_date desc&rows=10&start=0&q=*:*, parameter start is variable value, every request increased 10.
When i make performance stress testing, the SOLR server CPU usage close to reach to 100%.

Question:
1.What causes high CPU usage?
2.Is there a way to make low CPU usage, such as cache or other configuration.

This is a part section for query cache configuration in solrconfig.xml
1024

<queryResultCache
    class="solr.LRUCache"
    size="40960"
    initialSize="10240"
    autowarmCount="512"/>

<documentCache
    class="solr.FastLRUCache"
    size="40960"
    initialSize="10240"
    autowarmCount="0"/>

<enableLazyFieldLoading>true</enableLazyFieldLoading>

<queryResultWindowSize>10</queryResultWindowSize>

<queryResultMaxDocsCached>500</queryResultMaxDocsCached>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柠北森屋 2024-11-10 03:33:37

我在管理像您这样的大型索引(使用 Autonomy 搜索引擎)方面的经验是,100% CPU 是正常的。因为索引存储在 RAM 中,所以没有 I/O 活动来减慢搜索操作,CPU 将尝试尽快读取 RAM,这意味着接近 100% CPU。

为什么你希望你的搜索使用 50% 的 CPU,它会花费 2 倍的时间,对吗?

AIX 有一个名为 nmon 的性能监控工具。在 nmon 的常见问题解答中,作者提醒我们

如果你继续使用越来越短的
你最终会看到
CPU 要么 100% 繁忙,要么 100%
闲置所有其他号码只是一个
人类思维不快的特点
足够并且必须平均
CPU 使用时间较长。

即使您没有使用 AIX 作为操作系统,nmon FAQ 中也有很多关于系统/应用程序性能监控和测量的好信息。我推荐它,或者您更多地谷歌搜索如何诊断系统中的性能问题。

另外,您可能想在您的帖子中添加一些标签。 SO 有大量的基准测试和测试活动。

我希望这有帮助。

My experience with managing a large index like you have (using Autonomy search engine), is that 100% CPU is to be expected. Because your index is stored in RAM, there is no I/O activity to slow down the search operation, and CPU will try to read through the RAM as fast as possible, meaning close to 100% CPU.

Why would you want your search to use 50% CPU, it will take 2x as long, right?

There is a performance monitoring tool for AIX called nmon. In the FAQ for nmon, the author reminds us

If you keep using shorter and shorter
periods you will eventually see that
the CPUs are either 100% busy or 100%
idle all the other numbers are just a
feature of humans not thinking fast
enough and having to average out the
CPU use in longer periods.

Even if you are not using AIX as your OS, there is a lot of good information in the nmon FAQ about system/application performance monitoring and measurement. I recommend it, or that you google more for how to diagnose performance issues in your system.

Also, you may want to add some tags to your posting. There is a fair amount of activity here at SO for bench-marking and testing.

I hope this helps.

相思碎 2024-11-10 03:33:37

编辑 solrconfig.xml 并更改 maxWarmingSearchers 值:

<maxWarmingSearchers>50</maxWarmingSearchers>

Edit your solrconfig.xml and change the maxWarmingSearchers value:

<maxWarmingSearchers>50</maxWarmingSearchers>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文