tjake / Solandra

Solandra = Solr + Cassandra
Apache License 2.0
882 stars 150 forks source link

With multiple shards, query cache is only storing the results of one shard. #134

Closed pcoleman closed 13 years ago

pcoleman commented 13 years ago

When running with multiple shards on a single serve we are seeing a bug where only the results from a single shard get cached for the query (Bug disappears when query cache is disabled). From the logs before you can see that in the first query we are getting different number of results from each shard. In the second query, that hits the cache, we are seeing the exact same number of results from each shard. This number is the same as the number we got from a single shard the first time around.

Setup:

16 core serve 1,000,000 documents 10 shards

Cache Settings:

   <filterCache
      class="solr.FastLRUCache"
      size="4096"
      initialSize="2048"
      autowarmCount="512"/>

  <queryResultCache
      class="solr.LRUCache"
      size="4096"
      initialSize="2048"
      autowarmCount="512"/>

   <documentCache
      class="solr.LRUCache"
      size="4096"
      initialSize="2048"
      autowarmCount="512"/>

    <enableLazyFieldLoading>true</enableLazyFieldLoading>

    <fieldValueCache
      class="solr.LRUCache"
      size="4096"
      initialSize="2048"
      autowarmCount="512"/>

Logs:

First time through, not cached.

INFO [pool-5-thread-1] 2011-09-20 09:42:56,998 QuerySenderListener.java (line 41) QuerySenderListener sending requests to Searcher@742eb8f3 main INFO [pool-5-thread-1] 2011-09-20 09:42:56,999 QuerySenderListener.java (line 77) QuerySenderListener done. INFO [pool-5-thread-1] 2011-09-20 09:42:56,999 SolrCore.java (line 1320) [df] Registered new searcher Searcher@742eb8f3 main INFO [1818148905@qtp-1834602347-0] 2011-09-20 09:42:57,061 CassandraIndexManager.java (line 274) Shards at once: 1 INFO [1818148905@qtp-1834602347-0] 2011-09-20 09:42:57,113 CassandraIndexManager.java (line 388) Found reserved shard12(87648753965203134514660833161141005296):129784 TO 131072 INFO [1998571977@qtp-1834602347-2] 2011-09-20 09:42:58,178 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=0 status=0 QTime=958 INFO [506078675@qtp-1834602347-9] 2011-09-20 09:42:58,178 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=0 status=0 QTime=958 INFO [1684860690@qtp-1834602347-8] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=58 status=0 QTime=2265 INFO [711809973@qtp-1834602347-13] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=1007 status=0 QTime=2266 INFO [413424145@qtp-1834602347-5] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=1216 status=0 QTime=2266 INFO [853810382@qtp-1834602347-7] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=2945 status=0 QTime=2266 INFO [600029495@qtp-1834602347-10] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=504 status=0 QTime=2266 INFO [2126659288@qtp-1834602347-14] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=893 status=0 QTime=2266 INFO [1953262766@qtp-1834602347-3] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=1037 status=0 QTime=2266 INFO [614032437@qtp-1834602347-6] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=1452 status=0 QTime=2265 INFO [664961701@qtp-1834602347-12] 2011-09-20 09:42:59,486 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=13536 status=0 QTime=2265 INFO [659409453@qtp-1834602347-4] 2011-09-20 09:42:59,563 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=661 status=0 QTime=2343 NFO [85277981@qtp-1834602347-11] 2011-09-20 09:42:59,643 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=2423 INFO [85277981@qtp-1834602347-11] 2011-09-20 09:42:59,816 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=name,city,province,key&q=city:dallas&ids=us/nc/dallas/2206hillsidedr,us/nc/dallas/128durkeeln,us/nc/dallas/3135dallashighshoalshwy,us/nc/dallas/208nspargost,us/nc/dallas/134roechlingst,us/nc/dallas/3501havenwoodrd,us/nc/dallas/217scollegest,us/nc/dallas/324spinest,us/nc/dallas/412lorayfarmrd,us/nc/dallas/121printhadrd&isShard=true&wt=javabin&version=2} status=0 QTime=149 INFO [1818148905@qtp-1834602347-0] 2011-09-20 09:42:59,818 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=name,city,province&wt=javabin&q=city:dallas&version=2} status=0 QTime=2809

Second time through, from cache.

INFO [1752962158@qtp-1834602347-26] 2011-09-20 10:03:23,533 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=2 INFO [38855296@qtp-1834602347-21] 2011-09-20 10:03:23,536 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [748099836@qtp-1834602347-19] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=5 INFO [359559736@qtp-1834602347-17] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=7 INFO [495860363@qtp-1834602347-18] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [342923004@qtp-1834602347-20] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=7 INFO [1566819223@qtp-1834602347-25] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [50496689@qtp-1834602347-27] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [1262482509@qtp-1834602347-23] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=7 INFO [1752962158@qtp-1834602347-26] 2011-09-20 10:03:23,533 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=2 INFO [38855296@qtp-1834602347-21] 2011-09-20 10:03:23,536 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [748099836@qtp-1834602347-19] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=5 INFO [359559736@qtp-1834602347-17] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=7 INFO [495860363@qtp-1834602347-18] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [342923004@qtp-1834602347-20] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=7 INFO [1566819223@qtp-1834602347-25] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [50496689@qtp-1834602347-27] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=6 INFO [1262482509@qtp-1834602347-23] 2011-09-20 10:03:23,538 SolrCore.java (line 1378) [df] webapp=/solandra path=/select params={fl=key,score&start=0&q=city:dallas&isShard=true&wt=javabin&fsv=true&rows=10&version=2} hits=23806 status=0 QTime=7

tjake commented 13 years ago

The query caches can not be used for this reason. The sample solrconfig.XML has these commented out.

pcoleman commented 13 years ago

I noticed they were commented out, I wasn't sure if that was the case. I guess I will have to optimize another way.

Thanks