Search code examples
solrcpu-usage

why CPU usage close to reach to 100% when i use SOLR query all document


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>

Solution

  • 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.