Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D9605263 for ; Thu, 12 May 2011 08:08:32 +0000 (UTC) Received: (qmail 32324 invoked by uid 500); 12 May 2011 08:08:31 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 32270 invoked by uid 500); 12 May 2011 08:08:31 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Delivered-To: moderator for dev@lucene.apache.org Received: (qmail 26332 invoked by uid 99); 12 May 2011 08:01:48 -0000 X-ASF-Spam-Status: No, hits=3.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kangsg219@gmail.com designates 209.85.214.176 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to:cc :content-type; bh=nTY3OhN/yCFGJpGEqYfjPSC0JlXcexg6m/MbzvxaEHY=; b=KEjPj5SWUhlA3fk+1/7P+bKeQfEXWBp+SGJ/Dw5/em+HeAsDCHh2A82HakjBEQdkwn 9EBv2jgH1fL1EOcQ5deZ2un9EwxKxvpJsppe/GSrism9H1hDTcaD2i5dmwbExYRL47If 9lLERGuTWX19RiJNjB/MNOckFcFDiI24RvEFE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=fT7a0HAq96ooLBxk1tksl+gPKLb6sTFj6z9X+yKDTCRPQtNZ/jm92VW0p+GQT8e0Rs jQNhiv5aaFcqEYYIjMhccukggEZdsSu/npLeCKnYNucZ8LQXpOV94CRjJbr6X0h6MHVh H+MwxLnthHT6P7WbfgpDJHtho9Jb7iPSGBcFU= MIME-Version: 1.0 Date: Thu, 12 May 2011 16:01:21 +0800 Message-ID: Subject: a optimizable point about solr From: shuigen kang To: dev@lucene.apache.org Cc: =?GB2312?B?srezwQ==?= , simonw@apache.org Content-Type: multipart/alternative; boundary=0015177407d045881c04a30f9805 --0015177407d045881c04a30f9805 Content-Type: text/plain; charset=ISO-8859-1 Hi all: *I was recently used solr to set up a Search Engine for our web site. In the process of performance test, I used jprofiler to analyse the operational aspect of solr , And found a optimizable point, in the method getLuceneVersion(String path, Version def) of class org.apache.solr.core.config. In this method,it will parse the config file with xml format each time when be invoked.* *it is terrible,look this:* * * http://dl.iteye.com/upload/picture/pic/89884/00ff1ee5-a156-354d-8eaa-35abdcd1cfa6.jpg http://dl.iteye.com/upload/picture/pic/89884/00ff1ee5-a156-354d-8eaa-35abdcd1cfa6.jpg *15.1%+14.2%, it cost 29.3% cpu resource,only a be of little use method. * *So I suggest to edit this method like this:* ------------------------------------------------------------------------ *public* Version getLuceneVersion(String path) { *if*(luceneVersion == *null*){ luceneVersion = *parseLuceneVersionString*(getVal(path, *true*)); } *return* luceneVersion; } ------------------------------------------------------------------------ *Only run parseLuceneVersionString() method at this first time to save the valuable and limited cpu resource.* * * *Any problem and what do you think?* Best regards. ** --0015177407d045881c04a30f9805 Content-Type: text/html; charset=GB2312 Content-Transfer-Encoding: quoted-printable

Hi all:

      = I was recently used solr to set up a Search Engine for our web site. In the process of performance test, I = used jprofiler to analyse the operational aspect of solr , And found a optimizab= le point, in the method  getLuceneVersion(String path, Version def) of cl= ass org.apache.solr.core.config. In this method,it will parse the config file w= ith xml format each time when be invoked.

it is terrible,look this:


http://dl= .iteye.com/upload/picture/pic/89884/00ff1ee5-a156-354d-8eaa-35abdcd1cfa6.jp= g

http://dl.iteye.co= m/upload/picture/pic/89884/00ff1ee5-a156-354d-8eaa-35abdcd1cfa6.jpg

=


15.1%+14.2%, it cost 29.3% cpu resource,only a be of little use method.

So I suggest to edit this method like this:


-----------------------------= -------------------------------------------

public Version getLuceneVersion(String path) {

       if(luceneVersion =3D=3D null){

        &nbs= p; luceneVersion = =3D parseLuceneVersionString(getVal(path, true));<= span lang=3D"EN-US">

       }

     return luceneVersion;

   }
--------------------------------= ----------------------------------------

Only run parseLuceneVersionString() method at t= his first time to save the valuable and limited cpu resource.=

 

Any problem and what do you think?

 

Best regards.



--0015177407d045881c04a30f9805--