lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shuigen kang <>
Subject a optimizable point about solr
Date Thu, 12 May 2011 08:01:21 GMT
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:*


*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.


View raw message