Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 29628 invoked from network); 22 Apr 2010 11:12:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Apr 2010 11:12:26 -0000 Received: (qmail 47073 invoked by uid 500); 22 Apr 2010 11:12:24 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 46941 invoked by uid 500); 22 Apr 2010 11:12:23 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 46932 invoked by uid 99); 22 Apr 2010 11:12:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Apr 2010 11:12:23 +0000 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=AWL,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.83.48] (HELO mail-gw0-f48.google.com) (74.125.83.48) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Apr 2010 11:12:16 +0000 Received: by gwb1 with SMTP id 1so1358139gwb.35 for ; Thu, 22 Apr 2010 04:11:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.190.12 with HTTP; Thu, 22 Apr 2010 04:11:55 -0700 (PDT) In-Reply-To: References: Date: Thu, 22 Apr 2010 07:11:55 -0400 Received: by 10.151.28.20 with SMTP id f20mr2043486ybj.178.1271934715487; Thu, 22 Apr 2010 04:11:55 -0700 (PDT) Message-ID: Subject: Re: Reopening a Searcher for each request From: Michael McCandless To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable It's the IndexReader that's costly to open/warm, so ideally it should be opened once and shared. The Searchers do very little on construction so re-creating per query should be OK. Mike On Thu, Apr 22, 2010 at 6:38 AM, Samarendra Pratap wr= ote: > Greetings to all. > =A0I have read at so many places that we should not open a Searcher for e= ach > request for the sake of performance, but I have always been wondering > whether it is actually Searcher or Reader? > > =A0I have a group of index amounting to 23G which actually contains of > different index directories. The structure is something like following > > Main directory > | > |_________ country1 > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___ country1-time1 (actual ind= ex) > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___ country1-time2 (actual ind= ex) > | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___ country1-time3 (actual ind= ex) > | > |_________ country2 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___ country2-time1 (actual index= ) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___ country2-time2 (actual index= ) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |___ country2-time3 (actual index= ) > > =A0When application starts I open IndexReaders on all of actual index > directories (country1-time1, country1-tim2, .... country2-time3) and keep > them in a pool. > > =A0At the time of search, IndexSearchers are created by selecting the > appropriate IndexReaders from the pool. These IndexSearchers in turn are > used to create a ParallelMultiSearcher. Constructors of IndexSearcher and > ParallelMultiSearcher are run for every request. > > =A0Now I believe that creating a pool of ParallelMultiSearcher itself is = a > good idea but* I wanted to know if reopening **IndexSearchers** will real= ly > degrade performance irrespective of **IndexReaders** being opened once*. > > In my performance tests (which may not be very comprehensive) I didn't fi= nd > any noticeable difference. > > Please throw some light. > > > -- > Regards, > Samar > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org