You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Marc Sturlese <ma...@gmail.com> on 2010/02/21 02:59:00 UTC

Why synchronized access to FieldValueCache in getUninvertedField.java

I have noticed that in the class UninvertedField.java there is a synchronized
access to the FieldValueCache.
I would like to know why this access is synchronized. Could this end up in a
loss of performance when there are concurrent search requests?
I am doing as much research as I can as I have noticed a performance loss
when concurrent search happens. I described it with detail in another
thread:

http://old.nabble.com/Strange-performance-behaviour-when-concurrent-requests-are-done-td27659695.html
-- 
View this message in context: http://old.nabble.com/Why-synchronized-access-to-FieldValueCache-in-getUninvertedField.java-tp27672399p27672399.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Why synchronized access to FieldValueCache in getUninvertedField.java

Posted by Chris Hostetter <ho...@fucit.org>.
: I have noticed that in the class UninvertedField.java there is a synchronized
: access to the FieldValueCache.
: I would like to know why this access is synchronized. Could this end up in a
: loss of performance when there are concurrent search requests?

This only synchronizes when a value hasn't been found in the cache and 
needs to be generated (ie: it prevents multiple threads from generating 
values to put in the cache concurrently)

So concurrent requests that require the creation of UnInvertedField 
instances for distinct field names might be blocked when they don't need 
to be, but once the cache is populated "typical" searches should never see 
that synchronized block.

(the synchronization could probably be improved however, by syncronizing 
on a CreationPlaceholder like FieldCache does)



-Hoss