Use memcached cache instead of LRUCache cache in SOLR

Source: Internet
Author: User

Frontier

In the search engine, the cache is considered an indispensable part, but in many cases, the implementation of the cache over-reliance on the distributor and webserver will greatly aggravate the burden of webserver, the specific performance is the recurrent suspended animation, denial of service, so in order to liberate the front-end forwarding server, We will implement the cache using the SOLR + memcache backend partner combination.

Pre-preparation conditions:

Click below to download the Memcache Essentials Toolkit and Java class to your local

Memcached-2.2.jar

Spy-2.4.jar

Http://solr-side.googlecode.com/files/solr-memcache.zip

Operation Steps:

    • Unzip the solr-memcache.zip into a folder, open the folder
    • Cut the Memcached-2.2.jar and Spy-2.4.jar in the Lib folder under the Solr-memcache folder to the Lib folder in the SOLR project and make the relevant references.
    • Place the Memcachedcache.java file in Src/main/java/org/apache/solr/search in this Solr-memcahe folder in the location of the package specified in the SOLR project: Org.apache.solr.search
    • Org.apache.solr.search found Docset.java in the SOLR project
    • Enables the Docsetbase class in the file to implement the Serializable interface to support serialization.
    • Modify the Solrconfig.xml file, locate the Queryresultcache portal, comment out this node, and add the following nodes:
    1. <queryresultcache     
    2.     class=
    3.     memcachedhosts=" 192.168.0.100,192.168.0.101:1234,192.168.0.103 "     
    4.     exptime=" 21600 "&NBSP;&NBSP;&NBSP;&NBSP;
    5.     < span class= "attribute" >defaultport= "11211" &NBSP;&NBSP;&NBSP;&NBSP;
    6.     keyprefix= "" />   

Restart SOLR, open SOLR's status display page to see if the previous LRUCache was replaced by Memcachecache

http://192.168.1.109:8080/solr/novel/admin/stats.jsp

View Plaincopy

  1. Name:queryresultcache
  2. Class:org.apache.solr.search.MemcachedCache
  3. Version: 1.0
  4. Description:memcachedcache ([192.168. 1.109], Defaultport:11211, Exptime:21600, Keyprefix:)
  5. Stats:lookups: 2
  6. Hits: 0
  7. Hitratio: 0.00
  8. Inserts: 3
  9. Evictions: 0
  10. Size: 0
  11. Warmuptime: 0
  12. Cumulative_lookups: 2
  13. Cumulative_hits: 0
  14. Cumulative_hitratio: 0.00
  15. Cumulative_inserts: 2
  16. Cumulative_evictions: 0
  17. Indexversion: 0

Parameter indication

    • memcachedhosts:memcached server IP, multiple intermediate "," number separated
    • Exptime: Failure time (in seconds)
    • Defaultport:memcached using port numbers

Use memcached cache instead of LRUCache cache in SOLR

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.