`
san_yun
  • 浏览: 2639660 次
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

solr 的cache

    博客分类:
  • solr
 
阅读更多

我是通过 python脚本对solr 进行cache测试的:

 

1.  在同一个请求中会被缓存,但进程结束之后 cache 就失效了。

2.  时间范围过滤对性能影响很大: 6天200ms,60天800ms,4倍差异。

3.  经测试not id :0和普通关键字性能没有差异。

 

测试代码:

         fq = ['category:9 OR category:1', '-pop_score:0', '-status:6', '-photo_id:0', 'buyable:0 OR buyable:11 OR buyable:14', 'favorite_count:[1 TO *]']
 
	 from_date = datetime.datetime.now() - datetime.timedelta(days=60)
  	 fq.append("add_datetime:[%s TO *]" % from_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
 
	 tag_set = ['NOT id:0']
	 kw = tag_set and " OR ".join(tag_set) or "*:*"
	 query(kw, sort=sort, fq=fq) 
	 
	 count = 0
	 while count<5:
	 	query(kw, start=count*24,sort=sort, fq=fq)
	 	count= count+1
 

请求参数:

NOT id:0 {'fq': ['category:9 OR category:1', '-pop_score:0', '-status:6', '-photo_id:0', 'buyable:0 OR buyable:11 OR buyable:14', 'favorite_count:[1 TO *]', 'add_datetime:[2012-05-13T17:48:31Z TO *]'], 'rows': 24, 'start': 0}
 

 

Jul 12, 2012 5:46:00 PM org.apache.solr.core.SolrCore execute
INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=0&q=NOT+id:0&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=favorite_count:[1+TO+*]&fq=add_datetime:[2012-05-13T17:45:59Z+TO+*]&rows=24&version=2.2} hits=111738 status=0 QTime=1232 第一次请求
Jul 12, 2012 5:46:00 PM org.apache.solr.core.SolrCore execute
INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=0 &q=NOT+id:0&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=favorite_count:[1+TO+*]&fq=add_datetime:[2012-05-13T17:45:59Z+TO+*]&rows=24&version=2.2} hits=111738 status=0 QTime=0 (cache )
Jul 12, 2012 5:46:00 PM org.apache.solr.core.SolrCore execute
INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=24 &q=NOT+id:0&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=favorite_count:[1+TO+*]&fq=add_datetime:[2012-05-13T17:45:59Z+TO+*]&rows=24&version=2.2} hits=111738 status=0 QTime=1 (cache )
Jul 12, 2012 5:46:00 PM org.apache.solr.core.SolrCore execute
INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=48 &q=NOT+id:0&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=favorite_count:[1+TO+*]&fq=add_datetime:[2012-05-13T17:45:59Z+TO+*]&rows=24&version=2.2} hits=111738 status=0 QTime=0 (cache )
Jul 12, 2012 5:46:00 PM org.apache.solr.core.SolrCore execute
INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=72 &q=NOT+id:0&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=favorite_count:[1+TO+*]&fq=add_datetime:[2012-05-13T17:45:59Z+TO+*]&rows=24&version=2.2} hits=111738 status=0 QTime=0 (cache )
Jul 12, 2012 5:46:00 PM org.apache.solr.core.SolrCore execute
INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=96 &q=NOT+id:0&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=favorite_count:[1+TO+*]&fq=add_datetime:[2012-05-13T17:45:59Z+TO+*]&rows=24&version=2.2} hits=111738 status=0 QTime=0 (cache )

 

 

 

 

这几个请求也没有走cache.

INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=90&q=*&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=add_datetime:[2012-06-18T21:03:33Z+TO+*]&fq=favorite_count:[1+TO+*]&rows=30&version=2.2} hits=38600 status=0 QTime=561


INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=1380&q=*&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=add_datetime:[2012-06-18T21:11:58Z+TO+*]&fq=favorite_count:[1+TO+*]&rows=30&version=2.2} hits=38589 status=0 QTime=656


INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=90&q=*&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=add_datetime:[2012-06-18T21:11:58Z+TO+*]&fq=favorite_count:[1+TO+*]&rows=30&version=2.2} hits=38589 status=0 QTime=701


INFO: [feed] webapp=/solr path=/select params={fl=id&sort=last_replied_datetime+desc&start=120&q=*&wt=standard&fq=category:9+OR+category:1&fq=-pop_score:0&fq=-status:6&fq=-photo_id:0&fq=buyable:0+OR+buyable:11+OR+buyable:14&fq=add_datetime:[2012-06-18T21:11:58Z+TO+*]&fq=favorite_count:[1+TO+*]&rows=24&version=2.2} hits=38589 status=0 QTime=634

 

 

http://hankesi2000.iteye.com/blog/1083377

 

 

 

分享到:
评论

相关推荐

    solr cache部分 中文解释

    LFUCache 基于条目的访问频率来决定哪些条目应该被移除。当缓存满时,访问频率最低的条目会被淘汰,以让位于新的条目。这种策略旨在保留最常使用的条目,从而提高整体性能。 在 Solr 中,缓存主要用作加速查询和...

    solr中cache综述

    Solr提供了两种主要的`SolrCache`接口实现类,即`solr.search.LRUCache`和`solr.search.FastLRUCache`。 1. **solr.search.LRUCache**:基于LRU(Least Recently Used,最近最少使用)算法实现,适用于需要根据访问...

    高效的企业级搜索引擎Solr

    SolrCache缓存 - **LRUCache**:采用了最近最少使用的策略来管理缓存中的数据,当缓存空间不足时,会优先移除最近最少使用的项。 - **FastLRUCache**:这是在Solr 1.4版本中引入的一种更高效的缓存实现方式,相较...

    Solr(Cloudera)使用手册

    &lt;cache name="queryResultCache" class="org.apache.solr.cache.LRUCache" default="true"&gt; &lt;int name="size"&gt;1000 &lt;/cache&gt; ``` 4. **Cache的命中监控**:通过监控工具检查缓存的命中率,以评估缓存的效果...

    solr教材-PDF版

    ### Solr教材知识点详解 #### 一、概述 **1.1 企业搜索引擎方案选型** 在企业级应用中,为了提升用户体验并更好地处理大量数据的检索需求,选择合适的搜索引擎解决方案至关重要。通常有几种常见的方案: 1. **...

    apache-solr7.7

    9. **性能优化**:Solr包含多种性能优化策略,如块级存储(Block Store)、缓存机制(Query Result Cache、Document Cache等)以及并发控制策略,以提高查询速度和系统响应时间。 10. **监控与日志**:Solr提供了...

    solr更换memcached缓存的方法

    &lt;cache name="queryResultCache" class="solr.search.LRUCache" shared="true" size="512" initialSize="512" autowarmCount="100" regenerator="solr.NoOpRegenerator" cacheImpl="solr....

    solr基础知识介绍

    Solr的缓存机制包括filterCache、queryResultCache和documentCache,它们分别用于优化过滤器、查询结果和文档的缓存操作。文档还提供了一个关于SolrJ的介绍,SolrJ是Solr的Java客户端,它支持与Solr服务器的交互。...

    Solr结合Java所需Jar

    10. **性能优化**:了解Solr的缓存机制(如QueryResultCache、DocumentCache等)和并发控制策略,有助于提高Java应用与Solr交互的性能。 通过理解和应用上述知识点,Java开发者能够在项目中顺利地集成Solr,构建...

    solr-4.9.1

    9. **搜索性能优化**:Solr提供多种手段来优化搜索性能,如使用倒排索引、缓存策略、查询过滤器缓存(QueryResultCache)、文档缓存(DocumentCache)等。 总的来说,Solr-4.9.1是一个全面的搜索引擎解决方案,它...

    apache solr 源文件 3.6.1

    这些缓存在`Cache`接口和相关实现类中定义。 10. **插件系统**:Solr允许用户自定义查询解析器、过滤器、请求处理器等,源代码中有很多插件实现的例子。 通过研究Apache Solr 3.6.1的源代码,不仅可以深入了解其...

    solr搜索引擎支持分页

    Solr提供了一种跳转分页的方式,即通过`fq`参数配合`cache`和`query`,避免计算所有结果,从而提高性能。 6. SolrCloud与分布式分页: 在SolrCloud模式下,Solr支持分布式搜索和分片,这意味着分页请求会被自动...

    linux+tomcat+mysql+solr调优

    3. **缓存机制**:利用Solr提供的多种缓存机制(如Field Cache、Query Result Cache等),减少对索引文件的访问。 4. **并行处理**:利用SolrCloud的分布式特性,实现数据的并行处理。 5. **资源管理**:合理分配...

    Solr.学习文档

    - **缓存机制**:合理利用缓存可以极大地提高查询速度,如使用 QueryResultCache 和 DocValuesCache 等。 2. **查询优化**: - **过滤器与排序**:使用过滤器而不是查询来限制结果集,这可以显著提高查询效率。 ...

    开源企业搜索引擎SOLR的应用教程

    ### 开源企业搜索引擎SOLR的应用教程 #### 一、概述与特性介绍 **1.1 企业搜索引擎方案选型** 对于门户社区等网站来说,搜索引擎功能是提升用户体验的关键因素之一。当前,针对搜索引擎功能的需求有多种解决方案...

    开源企业搜索引擎SOLR的 应用教程

    ### 开源企业搜索引擎SOLR的应用教程 #### 一、概述 **1.1 企业搜索引擎方案选型** 随着互联网的发展以及用户对于信息检索需求的增长,企业级搜索引擎成为了提升用户体验的关键技术之一。针对不同的应用场景,有...

    apache.solr.4.cookbook

    - **使用缓存**:利用Solr的缓存机制,如QueryResultCache和FieldCache,减少对磁盘的访问,提高查询速度。 - **并行处理**:利用多核CPU进行并行索引和查询,提高处理效率。 - **负载均衡**:通过Sharding(分片)...

Global site tag (gtag.js) - Google Analytics