Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A18CC11AE5 for ; Tue, 6 May 2014 08:36:35 +0000 (UTC) Received: (qmail 19231 invoked by uid 500); 6 May 2014 08:36:14 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 18936 invoked by uid 500); 6 May 2014 08:36:13 -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 18917 invoked by uid 99); 6 May 2014 08:36:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2014 08:36:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Sascha.Janz@gmx.net designates 212.227.17.20 as permitted sender) Received: from [212.227.17.20] (HELO mout.gmx.net) (212.227.17.20) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2014 08:36:08 +0000 Received: from [83.236.141.102] by 3capp-gmx-bs70 with HTTP; Tue, 6 May 2014 10:35:45 +0200 MIME-Version: 1.0 Message-ID: From: "Sascha Janz" To: java-user@lucene.apache.org Subject: =?UTF-8?Q?Aw=3A_RE=3A_=E5=9B=9E=E5=A4=8D=EF=BC=9A_Never_clo?= =?UTF-8?Q?se_IndexWriter/Reader=3F?= Content-Type: text/plain; charset=UTF-8 Date: Tue, 6 May 2014 10:35:45 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <004801cf6775$764917d0$62db4770$@thetaphi.de> References: =?UTF-8?Q?<5365269a.2991420a.6567.13d1SMTPIN_ADDED_BROKEN@mx.google.com>=09=20,=20<004801cf6775$764917d0$62db4770$@thetaphi.de>?= Content-Transfer-Encoding: quoted-printable X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K0:w+p1tf5vACbveji/YRFE8laQWQcla9c7cJSIsQEfjEG CvNadIIZsSuMtBfFcjHaecLOTLahxwdSpPf9h5C9wo6ixWDJ+S tjYR7U66yGem7a+aPH6TGOQIY0ukdIVPbuXJLTjr2LHJOzImZX KfqGwRGi7/wIgtLOlergUlhlTeNkQqD/CBYeXMcee77hio7Tct H5GB5sFyuAG+U+Hdbf+Wf2or4PzVVfhIs3K9ZrRsPe6bHHod3h rC8VllTJBphdmkNwyjebszINWm7DNjz8aKS6g/mCjEN27G5xim ouuPOI= X-Virus-Checked: Checked by ClamAV on apache.org Hello, =20 many thanks to your answers. i modified our sources to leave the IndexWri= ter open. Also we changed the commit strategy. may be we will do commit onl= y at night. We used to create own IndexReader for search. Now we changed th= is using SearcherManager which performs quite well. =20 We have an Index of nearly 50 GB. I am very curious how it will perform af= ter the changes. may it will be like unlocking a handbrake. i hope so. =20 Sascha ps Uwe: i will be at your jax session next week. =C2=A0 =C2=A0 Gesendet:=C2=A0Sonntag, 04. Mai 2014 um 10:47 Uhr Von:=C2=A0"Uwe Schindler" An:=C2=A0java-user@lucene.apache.org Betreff:=C2=A0RE: =E5=9B=9E=E5=A4=8D=EF=BC=9A Never close IndexWriter/Read= er? Hi, I would not do that. Reopening the NRT reader is not as expensive as commi= tting (which also fsyncs), but the current indexed data has to be written t= o a new segment on disk (called flush in Lucene world). So reopenening peri= odically is the better approach (unless you have really seldom accesses lik= e one query per 1 minute). E.g., Elasticsearch reopens, by default, periodi= cally every second. Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: uwe@thetaphi.de > -----Original Message----- > From: 308181687 [mailto:308181687@qq.com] > Sent: Sunday, May 04, 2014 6:05 AM > To: java-user > Subject: =E5=9B=9E=E5=A4=8D=EF=BC=9A Never close IndexWriter/Reader? > > Hi, Mike. Instead of periodically reopen NRT reader , I open/close it fo= r every > search query , will this result in performance issue? > > > Thanks > lubin > > > > > ------------------ =E5=8E=9F=E5=A7=8B=E9=82=AE=E4=BB=B6 ----------------= -- > =E5=8F=91=E4=BB=B6=E4=BA=BA: "Michael McCandless";; > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2014=E5=B9=B45=E6=9C=884=E6=97=A5(= =E6=98=9F=E6=9C=9F=E5=A4=A9) =E5=87=8C=E6=99=A81:43 > =E6=94=B6=E4=BB=B6=E4=BA=BA: "Lucene Users"= ; > > =E4=B8=BB=E9=A2=98: Re: Never close IndexWriter/Reader? > > > > Just leave your IW open forever and periodically reopen your NRT > reader. Be sure you close your old NRT reader after opening a new > one; SearcherManager makes this easy when multiple threads are using > the readers. > > Committing every 200 docs seems quite frequent: commit is very costly, > and it's only needed for recovery (so you know which docs are in the > index if the machine/OS crashes). > > Mike McCandless > > http://blog.mikemccandless.com[http://blog.mikemccandless.com] > > > On Sat, May 3, 2014 at 11:46 AM, Sascha Janz wrote= : > > Hi, > > > > > > > > We use lucene 4.6, our application receives continuously new documents= . > > Mostly emails. We need the update near real time, so we open the > IndexReader > > with Directory.open and IndexWriter. > > > > > > > > Periodically we do a commit, e.g. every 200 documents. > > > > > > > > We used to close the IndexWriter on commit, and then open a new one. I > read > > in documentation this is quite expensive, tests also showed me this. S= o we > > think about to only commit the IndexWriter and leave it open. So when > should > > we close the IndexWriter? I think about to leave it open and only clos= e it, > > when the server is shutting down. Is this a good idea? Any suggestions= or > > comments? Would be nice J > > > > > > > > Greetings > > > > Sascha > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > . --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org =C2=A0 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org