lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wilson Wu <songzi0...@gmail.com>
Subject help needed improving lucene concurret search performance
Date Fri, 23 Oct 2009 06:18:08 GMT
Dear Friend,
     I have encountered some performance problems recently in lucene
search 2.9. I use a single IndexSearcher in the whole system, It seems
perfect when there is less than 10 threads doing search concurrenty.
Bu if there is more than 100 threads doing concurrent search,the
average response time is becoming bigger(>1s),and the max response
time reaches 299s. I really don't know how to improve,can you help me?
   Thanks a lot !

                                                              Wilson
                                                              2009.10.23
    The profiling result about 400 concurret search is at:
http://i3.6.cn/cvbnm/aa/f5/00/63521d982a469f5063b82268eee91d08.gif
it seems a lot of time consumed by TermScorer.score.
    Follewing is my servlet class which is reponse to search request:
public final class DispatchServlet extends
javax.servlet.http.HttpServlet implements javax.servlet.Servlet
{
      private static final long serialVersionUID = -5547647006004900451L;
      protected final Log log = LogFactory.getLog(getClass());
      protected Searcher searcher;
      protected Directory dir;
      protected RAMDirectory ram;

    public DispatchServlet() {
        super();
     }

    public void init() throws ServletException {
        super.init();
        try {

               dir = FSDirectory.open(new
File("/usr/bestv/search_engin_index/index/program"));
                ram = new RAMDirectory(dir);
                searcher = new IndexSearcher(ram,true);
                int h = searcher.search(tq,null,1).totalHits;
                System.out.println("the searcher has warmed and
searched " + h + " docs" );
            }
        } catch (IOException e) {
            log.error(e);
        }
  }

protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
               response.setContentType("text/html");
               doExecute(request.getParameter("q"),response);
       }

protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
               response.setContentType("text/html");
               try{
                       String schCon =
URLDecoder.decode(request.getParameter("q"),"UTF-8");
                       doExecute(schCon,response);
               }catch(Exception e){
                       response.getWriter().write("Parameter
Error,please send param 'q'");
               }
       }

    public void doExecute(String schCon,HttpServletResponse response)
throws ServletException,IOException{
               response.getWriter().write(new SearchCommand().search(searcher));
  }

}

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message