Solr4.7 Cache Technology

Source: Internet
Author: User

Disk IO is often a prominent bottleneck in computer system response speed, search engine query is very ordinary, reduce the search process of disk IO to enhance the search response speed is undoubtedly a great help, in SOLR, provide a self-contained cache mechanism. We just need to add a few configuration items to the Solrconfig.xml.

Let's take a look at SOLR's 3 caches.

Filter cache: This is the result of the cache filter (that is, query parameter FQ) and the basic enumeration type.

Document cache: This is the thing that is used to cache Lucene documents, which is the one that stores the field.

Query Result cache: This is a glance that caches the results of queries.

First, cache configuration

SOLR's cache configuration is in the query configuration section of the Solrconfig.xml file, which is between the <query> and </query> tags. SOLR implements 2 kinds of caching mechanisms, namely LRUCache, Fastlrucache;

LRUCache: Thread-safe linkedhashmap implementation.

Fastlrucache: Based on CONCURRENTHASHMAP implementation.

A single-threaded case Fastlrucache has a faster get operation and slower puts operations, so the query hit rate using it will be higher than LRUCache 75%, although the gap may be greater in multi-threaded situations.

Parameter description:

Class: Specifies which caching mechanism to use with SOLR.

Size: The amount of cache space that is allowed to allocate the number of entities (entity).

InitialSize: Allocates cache space for the initial number of entities (entity).

Autowarmcount: The number of entities that are automatically preloaded in.

1. Filter Cache

[HTML]View Plaincopy
    1. <Filtercache
    2. class="SOLR. Fastlrucache "
    3. size="
    4. initialsize="
    5. autowarmcount="/> "


2, Documentcache

[HTML]View Plaincopy
    1. <Queryresultcache
    2. class="SOLR. Fastlrucache "
    3. size="
    4. initialsize="
    5. autowarmcount="/> "


3. QueryResult Cache

[HTML]View Plaincopy
    1. <Documentcache
    2. class="SOLR. Fastlrucache "
    3. size="11000"
    4. initialsize="11000" />


4. Query Result window value setting

The query Result window value is used with query result cache. What is the concept of this value is that I set the Query Results window value of 50, I query 20 to 30 of the data, the first query SOLR will be removed from the index library 0 to 49 of the data, I will not have to page the index library to query, directly from the cache to take it, Greatly improves the query response speed.

[HTML]View Plaincopy
    1. <queryresultwindowsize>50</queryresultwindowsize>


Second, complete configuration

    1. <!--cache configuration--
    2. <query>
    3. <!--filter cache-->
    4. <filtercache
    5. class="SOLR. Fastlrucache "
    6. size="
    7. initialsize="
    8. autowarmcount="/> "
    9. <!--query results cache-->
    10. <queryresultcache
    11. class="SOLR. Fastlrucache "
    12. size="
    13. initialsize="
    14. autowarmcount="/> "
    15. <!--document Cache-->
    16. <documentcache
    17. class="SOLR. Fastlrucache "
    18. size="11000"
    19. initialsize="11000" />
    20. <queryresultwindowsize>200</queryresultwindowsize>
    21. </Query>

Solr4.7 Cache Technology

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.