为什么当我使用SOLR查询所有文档时CPU使用率接近100%
我有一个使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在管理像您这样的大型索引(使用 Autonomy 搜索引擎)方面的经验是,100% CPU 是正常的。因为索引存储在 RAM 中,所以没有 I/O 活动来减慢搜索操作,CPU 将尝试尽快读取 RAM,这意味着接近 100% CPU。
为什么你希望你的搜索使用 50% 的 CPU,它会花费 2 倍的时间,对吗?
AIX 有一个名为 nmon 的性能监控工具。在 nmon 的常见问题解答中,作者提醒我们
即使您没有使用 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
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.
编辑
solrconfig.xml
并更改maxWarmingSearchers
值:Edit your
solrconfig.xml
and change themaxWarmingSearchers
value: