You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Aviran <am...@infosciences.com> on 2004/07/08 21:21:27 UTC

Are synchronized objects necessary in FieldInfos

Hi all,
First let me explain what I found out. I'm running Lucene on a 4 CPU server.
While doing some stress tests I've noticed that searching threads are
blocked on the method: public FieldInfo fieldInfo(int fieldNumber)
This causes for a significant cpu idle time. I noticed that the class
org.apache.lucene.index.FieldInfos uses private class members Vector
byNumber and Hashtable byName, both of which are synchronized objects. By
changing the Vector byNumber to ArrayList byNumber I was able to get 110%
improvement in performance (number of searches per second).
 
My question is: do the fields byNumber and byName have to be synchronized
and what can happen if I'll change them to be ArrayList and HashMap which
are not synchronized ?