欢迎投稿

今日深度:

solr 的cache,

solr 的cache,


我是通过 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

 

 

 

www.htsjk.Com true http://www.htsjk.com/solr/39327.html NewsArticle solr 的cache, 我是通过 python脚本对solr 进行cache测试的:   1.  在同一个请求中会被缓存,但进程结束之后 cache 就失效了。 2.  时间范围过滤对性能影响很大: 6天200ms,60天800ms,4倍差...
相关文章
    暂无相关文章
评论暂时关闭